Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jim Pryor <lists+caml@jimpryor.net>
To: caml-list@yquem.inria.fr
Subject: Re: How public is Num.Nat
Date: Sat, 10 Jul 2010 08:42:28 -0400	[thread overview]
Message-ID: <20100710124228.GD2772@vaio.earthlink.net> (raw)
In-Reply-To: <7d8707de0811070133s5b4b8b36kd514eadb0be8a78f@mail.gmail.com>

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
profjim@jimpryor.net


  reply	other threads:[~2010-07-10 12:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-07  9:33 Andrej Bauer
2010-07-10 12:42 ` Jim Pryor [this message]
2010-07-10 14:56   ` [Caml-list] " Jim Pryor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100710124228.GD2772@vaio.earthlink.net \
    --to=lists+caml@jimpryor.net \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox