[Haskell-cafe] about integer and float operations

Manlio Perillo manlio_perillo at libero.it
Thu Feb 5 06:40:49 EST 2009

Yitzchak Gale ha scritto:
> [...]
>> Suppose we have a function
>>    decodeIntegerAsFloat :: RealFloat a => Integer -> (Integer,a)
>> such that if (s,m) = decodeIntegerAsFloat x
>> then either x = 0 and s = 0 and m = 0
>>         or x = m * 2**s (mathematically) and abs m \in [0.5,1.0).
> Yes, that is what Manlio wants. Sometimes you need to divide
> two very large Integers with a floating point number as result,
> without the overhead of constructing a Rational from them.

By the way: it is possible to use a private constructor (via some 
special GHC flag?).
I would like to do a quick performance check using the existing 
fromRational specialization by constructing a Rational directly.

I know that Haskell allows declaration hiding for program safety, but 
sometimes this can be a nuisance.

 > [...]

Thanks  Manlio Perillo

More information about the Haskell-Cafe mailing list