[Haskell-cafe] ANN: ieee version 0.7

John Millikin jmillikin at gmail.com
Mon Sep 20 00:47:12 EDT 2010

On Sun, Sep 19, 2010 at 21:43, Patrick Perry <patperry at gmail.com> wrote:
>> I needed "real" IEEE754 binary support for round-trip parsing, where
>> (for example) maintaining the particular bit pattern of a NaN is
>> important. For 99% of people, the "unsafe" method will work fine.
> How does a C-style cast not preserve the bit pattern of a NaN?  Again,
> sorry if this is a stupid question.

It's not a stupid question, and I don't know the answer. But if you
plug a C-style cast into the data-binary-ieee754 unit tests, some of
them (the fiddly ones, like roundtripping -NaN) will fail. Presumably,
this is due to some optimization deep in the bowels of GHC, but I
don't understand even a fraction of what goes on in there.

For what it's worth, d-b-ieee754 was the very first Haskell library I
ever wrote -- and it shows. If anybody knows how to make unsafeCoerce
(or equivalent) roundtrip-safe, I would love to rip out all the ugly
and make it sane.

More information about the Haskell-Cafe mailing list