[Haskell-cafe] instance Enum Double considered not entirely great?

Evan Laforge qdunkan at gmail.com
Tue Sep 27 08:02:19 CEST 2011


On Mon, Sep 26, 2011 at 10:50 AM, Chris Smith <cdsmith at gmail.com> wrote:
> On Mon, 2011-09-26 at 18:53 +0200, Lennart Augustsson wrote:
>> If you do [0.1, 0.2 .. 0.3] it should leave out 0.3.  This is floating
>> point numbers and if you don't understand them, then don't use them.
>> The current behaviour of .. for floating point is totally broken, IMO.
>
> I'm curious, do you have even a single example of when the current
> behavior doesn't do what you really wanted anyway?  Why would you write

I've mentioned it a couple of times now, so I'll stop after this one,
but I sent the original email because I had spent a few hours tracking
down such an example.  When I went through and cleared out all the
uses of [..] I found a few other sketchy uses that may have been as
yet unmanifested bugs.

Actually, it was due to the additive nature and increasing inaccuracy,
so if the suggestion is to just to filter <= on the last element than
that's not a big improvement from my point of view.

But anyway I promise you Enum Double wasn't what I really wanted.  I
wrote my own range function that is what I really wanted.  And my
guess was that it's actually want most people really want.



More information about the Haskell-Cafe mailing list