[Haskell-cafe] Re: A question about "monad laws"

Wilhelm B. Kloke wb at arb-phys.uni-dortmund.de
Thu Feb 14 08:03:04 EST 2008


ajb at spamcop.net <ajb at spamcop.net> schrieb:
> G'day all.
>
> Richard A. O'Keefe wrote:
>
>> Hmm. Personally, I've never seen an algorithm where comparing for exact
>> equality was algorithmically necessary.
>
> One trick I've occasionally used is to avoid the need for a discriminated
> union of floating point and integer types by just using a floating point
> number.

IMHO it is a perfectly good idea to use the FP processor for integer
computations. You can use the Inexact Trap as Overflow Exception,
a service you don't get from i386 (and most other) hardware for int
operations. Of course your integers are limited to 24bit+sign in
single precision and 54bit+sign in double. In i387 extended precision
you get 64bit+sign.

I would consider a good idea if ghc would provide language support to
this sort of integers.
-- 
Dipl.-Math. Wilhelm Bernhard Kloke
Institut fuer Arbeitsphysiologie an der Universitaet Dortmund
Ardeystrasse 67, D-44139 Dortmund, Tel. 0231-1084-257
PGP: http://vestein.arb-phys.uni-dortmund.de/~wb/mypublic.key



More information about the Haskell-Cafe mailing list