
"Tim Chevalier"
Is there a pure Haskell implementation of Floats, i.e., one that (unlike GHC.Float) doesn't use foreign calls for things like isFloatNegativeZero? I don't care about performance; I'm just looking for something that doesn't use foreign calls.
You can easily do it yourself: data MyFloat m e = MyFloat m e | MyInfinity Bool | MyNaN A number x is represented in floating point as x = m * b^e, where m is called the mantissa, e the exponent and b the base. For performance reasons, usually b = 2 is chosen and both m and e are integers with fixed size. You'll find it useful to have a 'normalize' function, which 'moves the point', such that the mantissa isn't divisible by b, if possible. Greets, Ertugrul. -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://blog.ertes.de/