caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* convertion between OCaml Big_int and C
@ 2010-10-13 14:26 Jianzhou Zhao
  2010-10-13 14:48 ` [Caml-list] " Olivier Schwander
  0 siblings, 1 reply; 4+ messages in thread
From: Jianzhou Zhao @ 2010-10-13 14:26 UTC (permalink / raw)
  To: caml-list

Hi All,

I am not sure if this is a reasonable question. Does OCaml already
have functions that do convertion between arbitrary-precision integers
big_int in OCaml and any representation of large intergers in C? The
implementation of big_int (otherlibs/num/big_int.*) uses nat
(otherlibs/num/nat.*). Nat is a customized allocation (in C) as a list
of native integers to represent arbitrary-precision. So converting
big_int into C seems possible to me.

Thanks.
-- 
Jianzhou


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] convertion between OCaml Big_int and C
  2010-10-13 14:26 convertion between OCaml Big_int and C Jianzhou Zhao
@ 2010-10-13 14:48 ` Olivier Schwander
  2010-10-13 16:01   ` Jianzhou Zhao
  0 siblings, 1 reply; 4+ messages in thread
From: Olivier Schwander @ 2010-10-13 14:48 UTC (permalink / raw)
  To: caml-list

Le 13 Oct 2010 10:26, Jianzhou Zhao a écrit:
> I am not sure if this is a reasonable question. Does OCaml already
> have functions that do convertion between arbitrary-precision integers
> big_int in OCaml and any representation of large intergers in C? The
> implementation of big_int (otherlibs/num/big_int.*) uses nat
> (otherlibs/num/nat.*). Nat is a customized allocation (in C) as a list
> of native integers to represent arbitrary-precision. So converting
> big_int into C seems possible to me.

It seems you should have a look at the numerix library or at the OCaml
binding for GMP. I never used any of them so I cannot guaranty there are
really working (there are not a lot of references to them) but I think
they are more likely to be usable on both OCaml and C side.

Cheers,

Olivier


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] convertion between OCaml Big_int and C
  2010-10-13 14:48 ` [Caml-list] " Olivier Schwander
@ 2010-10-13 16:01   ` Jianzhou Zhao
  2010-10-13 16:11     ` Olivier Schwander
  0 siblings, 1 reply; 4+ messages in thread
From: Jianzhou Zhao @ 2010-10-13 16:01 UTC (permalink / raw)
  To: Olivier Schwander; +Cc: caml-list

On Wed, Oct 13, 2010 at 10:48 AM, Olivier Schwander
<olivier.schwander@chadok.info> wrote:
> Le 13 Oct 2010 10:26, Jianzhou Zhao a écrit:
>> I am not sure if this is a reasonable question. Does OCaml already
>> have functions that do convertion between arbitrary-precision integers
>> big_int in OCaml and any representation of large intergers in C? The
>> implementation of big_int (otherlibs/num/big_int.*) uses nat
>> (otherlibs/num/nat.*). Nat is a customized allocation (in C) as a list
>> of native integers to represent arbitrary-precision. So converting
>> big_int into C seems possible to me.
>
> It seems you should have a look at the numerix library or at the OCaml
> binding for GMP. I never used any of them so I cannot guaranty there are
> really working (there are not a lot of references to them) but I think
> they are more likely to be usable on both OCaml and C side.

Thanks. Are they the MLGMP and Numerix listed in "the Caml Hump:
General purpose libraries :: Numeric computation" ?
  http://caml.inria.fr/cgi-bin/hump.en.cgi?sort=0&browse=75
>From the documents of Numerix, it runs much faster than the big_int
library, although it may not be as portable as the 'nat' that big_int
replies on.

>
> Cheers,
>
> Olivier
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>



-- 
Jianzhou


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] convertion between OCaml Big_int and C
  2010-10-13 16:01   ` Jianzhou Zhao
@ 2010-10-13 16:11     ` Olivier Schwander
  0 siblings, 0 replies; 4+ messages in thread
From: Olivier Schwander @ 2010-10-13 16:11 UTC (permalink / raw)
  To: Jianzhou Zhao; +Cc: caml-list

Le 13 Oct 2010 12:01, Jianzhou Zhao a écrit:
> Thanks. Are they the MLGMP and Numerix listed in "the Caml Hump:
> General purpose libraries :: Numeric computation" ?
>   http://caml.inria.fr/cgi-bin/hump.en.cgi?sort=0&browse=75
> From the documents of Numerix, it runs much faster than the big_int
> library, although it may not be as portable as the 'nat' that big_int
> replies on.

Yes, there is also mlgmpidl
<http://www.inrialpes.fr/pop-art/people/bjeannet/mlxxxidl-forge/mlgmpidl/>.

Olivier


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-13 17:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-13 14:26 convertion between OCaml Big_int and C Jianzhou Zhao
2010-10-13 14:48 ` [Caml-list] " Olivier Schwander
2010-10-13 16:01   ` Jianzhou Zhao
2010-10-13 16:11     ` Olivier Schwander

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).