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 (20:30)
From: Pierre Weis <pierre.weis@i...>
Subject: Re: [Caml-list] Num library
Hi Jean-Christophe,

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

You should have reported this behaviour, since it is a bug: the
library was known to provide a normal form to value of type num. If it
fails to do so it is just an implementation flaw that we have to

> 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

Yes, you're right, it is almost impossible to handle: that why the
library was supposed to provide a normal form for nums ...

Pierre Weis

INRIA, Projet Cristal,,

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