caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* big_int
@ 2006-12-21 19:37 Serge Aleynikov
  2006-12-21 19:44 ` [Caml-list] big_int Serge Aleynikov
  0 siblings, 1 reply; 3+ messages in thread
From: Serge Aleynikov @ 2006-12-21 19:37 UTC (permalink / raw)
  To: caml-list

Greetings!

I'm trying to figure out how to pass a big integer (encoded using GMP 
library) from C to OCaml so that it could be read on the OCaml side 
using Big_int module.  The interoperability macros listed in the manual 
(http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html) and in the 
interoperability header files don't seem to have anything applicable for 
Big_int's.

Could someone point me to an example or resource of how to encode/decode 
a Big_int from/to C?

Thanks.

Serge

-- 
Serge Aleynikov
Routing R&D, IDT Telecom
Tel: +1 (973) 438-3436
Fax: +1 (973) 438-1464


^ permalink raw reply	[flat|nested] 3+ messages in thread
* [Caml-list] Big_int
@ 2001-11-01 11:21 Marcin 'Qrczak' Kowalczyk
  0 siblings, 0 replies; 3+ messages in thread
From: Marcin 'Qrczak' Kowalczyk @ 2001-11-01 11:21 UTC (permalink / raw)
  To: caml-list

Why do these functions perform copies of the abs_value instead of
sharing it? I thought that big_ints are immutable.

(* Opposite of a big_int *)
let minus_big_int bi =
 { sign = - bi.sign;
   abs_value = copy_nat (bi.abs_value) 0 (num_digits_big_int bi)}

(* Absolute value of a big_int *)
let abs_big_int bi =
    { sign = if bi.sign = 0 then 0 else 1;
      abs_value = copy_nat (bi.abs_value) 0 (num_digits_big_int bi)}

-- 
 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^
QRCZAK

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

end of thread, other threads:[~2006-12-21 19:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-21 19:37 big_int Serge Aleynikov
2006-12-21 19:44 ` [Caml-list] big_int Serge Aleynikov
  -- strict thread matches above, loose matches on Subject: below --
2001-11-01 11:21 [Caml-list] Big_int Marcin 'Qrczak' Kowalczyk

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).