Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Claude Marche <Claude.Marche@lri.fr>
To: Alain Frisch <frisch@clipper.ens.fr>
Subject: Re: [Caml-list] Num library
Date: Fri, 11 Oct 2002 15:23:57 +0200	[thread overview]
Message-ID: <15782.53485.872091.234807@mailhost.lri.fr> (raw)
In-Reply-To: <Pine.SOL.4.44.0210101033080.11248-100000@clipper.ens.fr>


I have no benchmark to produce, I just want to share my own experience:
I have an application where integers fit 99% of the time in machine
ints, but not always, and since I want to be sure that no overflow
occurs, I use the Num library. Some time ago, I've tried to used mlgmp
instead. On my own tests, that are not supposed to be exhaustive, mlgmp
was much faster when computing on really large integers, but when
integers are small, Num is much faster.

So I recommend to use mlgmp instead of Num only if you have large
integers most of the time. I tried also numerix, but it seems not
maintained anymore. Also I must say I did not use rational numbers.

As Jean-Christophe said, when using Nums you should take care not to
use structural equality (Pervasives.(=)) since representation of them
is not unique. So use Num.eq_num, Num.compare_num instead. Same issue,
you should not use Pervasives.hash, but something of your own.

Hope this helps.

- Claude


>>>>> "Alain" == Alain Frisch <frisch@clipper.ens.fr> writes:

    Alain> Hello Caml List,
    Alain> I'm considering using the Num library (from the standard distribution) for
    Alain> implementing numbers in an interpreter. Questions:

    Alain> - Is there any benchmark available ?  What is the overhead when dealing
    Alain>   with "small" integers ?

    Alain> - How does the library compare with other large/rational numbers
    Alain>   implementations ?

    Alain> - The manual mentions two special elements 1/0 and 0/0; it seems
    Alain>   that -1/0 is also available. Is it a bug in the manual or the
    Alain>   implementation ?

    Alain> -- Alain

-- 
| Claude Marché           | mailto:Claude.Marche@lri.fr |
| LRI - Bât. 490          | http://www.lri.fr/~marche/  |
| Université de Paris-Sud | phoneto: +33 1 69 15 64 85  |
| F-91405 ORSAY Cedex     | faxto: +33 1 69 15 65 86    |
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  parent reply	other threads:[~2002-10-11 15:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-10  8:42 Alain Frisch
2002-10-10  9:42 ` sebastien FURIC
2002-10-10 14:56   ` Yaron M. Minsky
2002-10-10 17:14     ` Pierre Weis
2002-10-10 18:53       ` Alain Frisch
2002-10-11 20:01         ` Pierre Weis
2002-10-10 19:45       ` Yaron M. Minsky
2002-10-10 17:08   ` Pierre Weis
2002-10-11  9:26     ` Sebastien Furic
2002-10-11 20:17       ` Pierre Weis
2002-10-11 10:22     ` Alessandro Baretta
2002-10-11 13:23 ` Claude Marche [this message]
2002-10-11 16:14   ` Sebastien Furic
2002-10-11 14:08 ` Jean-Christophe Filliatre
2002-10-11 18:35   ` "custom" operators in caml (was: Re: [Caml-list] Num library) Chris Hecker
2002-10-11 20:30   ` [Caml-list] Num library Pierre Weis

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=15782.53485.872091.234807@mailhost.lri.fr \
    --to=claude.marche@lri.fr \
    --cc=frisch@clipper.ens.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