[Haskell-cafe] Mystery of an Eq instance

John Lato jwlato at gmail.com
Tue Sep 24 22:32:52 CEST 2013

On Tue, Sep 24, 2013 at 11:36 AM, Stijn van Drongelen <rhymoid at gmail.com>wrote:

> On Tue, Sep 24, 2013 at 5:39 PM, Sven Panne <svenpanne at gmail.com> wrote:
>> 2013/9/22 Mike Meyer <mwm at mired.org>:
>> > On Sat, Sep 21, 2013 at 5:28 PM, Bardur Arantsson <spam at scientician.net
>> >
>> > wrote:
>> > Trying to make something whose name is "Not A Number" act like a
>> > number sounds broken from the start.
>> The point here is that IEEE floats are actually more something like a
>> "Maybe Float", with various "Nothing"s, i.e. the infinities and NaNs,
>> which all propagate in a well-defined way.
> So, `Either IeeeFault Float`? ;)

Sort of, but IeeeFault isn't really a zero.   Sometimes they can get back
to a normal Float value:

  Prelude> let x = 1.0/0
  Prelude> x
  Prelude> 1/x

Also, IEEE float support doesn't make sense as a library, it needs to be
built into the compiler (ignoring extensible compiler support via the
FFI).  The whole point of IEEE floats is that they're very fast, but in
order to take advantage of that the compiler needs to know about them in
order to use the proper CPU instructions.  Certainly you could emulate them
in software, but then they'd no longer be fast, so there'd be no point to
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130924/768012c3/attachment.htm>

More information about the Haskell-Cafe mailing list