Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Num library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jean-Christophe Filliatre <filliatr@l...>
Subject: Re: [Caml-list] Num library

Alain Frisch writes:
 > 
 > I'm considering using the Num library (from the standard distribution) for
 > implementing numbers in an interpreter. Questions:
 > 
 > - How does the library compare with other large/rational numbers
 >   implementations ?

I'm not going to comment on the efficiency of Num.

But, for  having tried  to use  it in a  serious software  and finally
replaced  it by  mlgmp, I  can mention  one true  weakness of  the Num
library: there is  no unicity of representation (e.g. 1  can be Int 1,
but  also Ratio  1/1, etc.)  and  consequently you  cannot use  caml's
comparison and hash functions over it.

Of course, you  can use compare_num (hash_num is  lacking, though) but
when  nums are  involved  within  huge datatypes,  you  have to  write
structural comparison  and hash functions  for these types. This  is a
pain, really.

-- 
Jean-Christophe

-------------------
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