[Haskell-beginners] ghci: inconsistent return values for succ

Iustin Pop iustin at k1024.org
Sun Oct 18 17:47:21 UTC 2015


On 2015-10-17 19:17:04, Frothy Bits wrote:
> Greetings,
> 
> Absolutely brand new to Haskell.  Taking ghci v7.10.2 out for a spin, and I
> find I get inconsistent return values for succ n:
> 
> ghci> succ 3.14
> 4.1400000000000001
> 
> for example instead of the expected 4.14

Separately from the technical implementation of succ for floating point
numbers, does it actually make sense to ask for the successor of a
non-integral value?

There must be some reason why Float and Double implement the Enum class,
but I can't understand in what sense (mathematically) are real numbers
enumerable.

confused,
iustin


More information about the Beginners mailing list