> | Prelude> [1.0,0.9..(-1.0)]
> | [1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.0999998, -2.38419e-07,
> | -0.1, -0.2, -0.3, -0.4, -0.5, -0.6, -0.7, -0.8, -0.9]
> | Prelude>
>
> In fact there were suggestions that Float and Double should be removed from
> the Enum class altogether because of potentially confusing behaviour in
> examples like this. But I don't think it is a bug, just a fact of life
> when you're working with floating point numbers.
For Hugs 98, it is a bug.
The Haskell 98 Report says in section 3.10:
For continuous Prelude types that are instances of Enum, namely Float
and Double, the semantics is given by the rules for Int, except that
the list terminates when the elements become greater than e3+i/2 for
positive increment i, or when they become less than e3+i/2 for
negative i.
To achieve this, numericEnumFromTo and numericEnumFromThenTo should be
changed to the versions given in the report's prelude.
BTW: There is still a comment above that code which is no longer
true. Is Simon Peyton Jones reading here?
Christian Sievers