From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA09239; Fri, 11 Oct 2002 17:41:31 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA09042 for ; Fri, 11 Oct 2002 17:41:30 +0200 (MET DST) Received: from lri.lri.fr (lri.lri.fr [129.175.15.1]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g9BFfTD02914 for ; Fri, 11 Oct 2002 17:41:29 +0200 (MET DST) Received: from serveur-mail.lri.fr (serveur-mail [129.175.8.90]) by lri.lri.fr (8.11.6/jtpda-5.3.2) with ESMTP id g9BFaxR09824 for ; Fri, 11 Oct 2002 17:36:59 +0200 (MEST) Received: from serveur-demons (mail@serveur-demons [129.175.8.130]) by serveur-mail.lri.fr (8.11.6/jtpda-5.3.2) with ESMTP id g9BFawx05803 for ; Fri, 11 Oct 2002 17:36:58 +0200 (MEST) Received: from marche by serveur-demons with local (Exim 3.35 #1 (Debian)) id 1801qU-000233-00 for ; Fri, 11 Oct 2002 17:36:58 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <15782.53485.872091.234807@mailhost.lri.fr> In-Reply-To: References: X-Mailer: VM 6.93 under Emacs 20.7.2 From: Claude Marche To: Alain Frisch Subject: Re: [Caml-list] Num library Date: Fri, 11 Oct 2002 15:23:57 +0200 X-MailScanner: Found to be clean Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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 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