From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 975B9BBAF for ; Wed, 13 Oct 2010 17:07:30 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AosBAGpotUyBaB4OmWdsb2JhbACTWI12FQEBAQEBCAsKBxEivGuFSASGb4hR X-IronPort-AV: E=Sophos;i="4.57,326,1283724000"; d="scan'208";a="72631143" Received: from mx-a.polytechnique.fr ([129.104.30.14]) by mail2-smtp-roc.national.inria.fr with ESMTP; 13 Oct 2010 17:07:30 +0200 Received: from argos.lix.polytechnique.fr (argos.lix.polytechnique.fr [129.104.11.2]) by mx-a.polytechnique.fr (tbp 5.3.2/2.0.7) with ESMTP id o9DF7AmT000835 for ; Wed, 13 Oct 2010 17:07:23 +0200 Received: from mailhost.lix.polytechnique.fr (pomerol.lix.polytechnique.fr [129.104.11.158]) by argos.lix.polytechnique.fr (Postfix) with ESMTP id 37B81AACA4 for ; Wed, 13 Oct 2010 16:48:30 +0200 (CEST) Received: (from schwander@localhost) by mailhost.lix.polytechnique.fr (8.14.4/8.12.8/Submit) id o9DEmU4R004523 for caml-list@yquem.inria.fr; Wed, 13 Oct 2010 16:48:30 +0200 Date: Wed, 13 Oct 2010 16:48:30 +0200 From: Olivier Schwander To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] convertion between OCaml Big_int and C Message-ID: <20101013144829.GB28174@pomerol.lix.polytechnique.fr> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.20 (2009-08-17) X-Spam: no; 0.00; ocaml:01 ocaml:01 integers:01 otherlibs:01 nat:01 otherlibs:01 nat:01 integers:01 numerix:01 cheers:01 26,:98 zhao:98 customized:98 caml-list:01 functions:01 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