Hi I'm looking into wrapping the Nat module from the Num package. I
can't find any documentation for it, but the source + a bit of guesswork makes
it somewhat accessible.

However, superficially at least it looks like this library enables
arbitrary getting/setting of bytes in the program's heap, with no
bounds checking. Please tell me it's not so!

$ ocaml dynlink.cma
        Objective Caml version 3.12.0+beta1

# #require "num";;
# open Nat;;
# let nx = nat_of_int 3;;
# let dump () = List.map (fun x -> nth_digit_nat nx x) [0;1;2;3;4;5;6;7;8];;
# dump ();;
- : int list =
[3; 1024; 1; 3074; 139752628822496; 1; 139752628800520; 1024; 1]
# set_digit_nat nx 6 111999111; nth_digit_nat nx 6;;
- : int = 111999111
# dump();;
- : int list = [3; 1024; 1; 3074; 139752628822496; 1; 111999111; 1024; 1]


I found this old message in the mailing list, but it seems to have gotten no 
answer:

On Fri, Nov 07, 2008 at 10:33:41AM +0100, Andrej Bauer wrote:
> The Nat module in the Num library is not documented in the official
> documentation, but is documented in the 1992 tech report by Valérie
> Ménissier-Morain. I would ilke to use Ocaml-only library for big
> integers which has bit shifting operations. Big_int does not, but Nat
> does. Is Nat stable and "safe to use" by people who are neither
> French, nor at INRIA, nor are they Ocaml developers?
> 
> Before someone tells me I should use GMP and/or MPFR: I am already
> using them, I am just rewriting a piece of code so that it can be
> optionally compiled with pure ocaml.

-- 
Jim Pryor
prof...@jimpryor.net

_______________________________________________
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

Reply via email to