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 SAA10338; Fri, 11 Oct 2002 18:15:24 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA10102 for ; Fri, 11 Oct 2002 18:15:23 +0200 (MET DST) Received: from mailhost.tni.fr (firewall.tni.fr [195.25.255.61]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g9BGFM502451 for ; Fri, 11 Oct 2002 18:15:22 +0200 (MET DST) Received: from groscool.tni.fr ([195.25.255.1]) by mailhost.tni.fr (Netscape Messaging Server 3.62) with SMTP id 3600; Fri, 11 Oct 2002 18:14:59 +0200 Received: from 192.168.7.60 by groscool.tni.fr (InterScan E-Mail VirusWall NT); Fri, 11 Oct 2002 18:14:59 +0200 (Paris, Madrid (heure d'été)) Message-ID: <3DA6F900.773571ED@tni-valiosys.com> Date: Fri, 11 Oct 2002 18:14:56 +0200 From: Sebastien Furic Organization: TNI X-Mailer: Mozilla 4.8 [en] (X11; U; Linux 2.4.18-6mdk i686) X-Accept-Language: en MIME-Version: 1.0 To: Claude Marche , "caml-list@inria.fr" Subject: Re: [Caml-list] Num library References: <15782.53485.872091.234807@mailhost.lri.fr> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Claude Marche wrote: > > 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. You must use Num.eq_num for another reason: Pervasives.( = ) fails at runtime on bigints and rationals. I had to rewrite parts of what I considered "generic" data structures when I have used them to store objects referencing bignums. Cheers, Sebastien. ------------------- 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