Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2002-10-11 (12:11)
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.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: