[Haskell-cafe] instance Enum Double considerednotentirelygreat?

Steve Schafer steve at fenestra.com
Wed Sep 28 02:57:34 CEST 2011


On Tue, 27 Sep 2011 13:13:39 -0600, you wrote:

>On Tue, 2011-09-27 at 12:36 -0400, Steve Schafer wrote:
>> [0.1,0.2..0.5] isn't the problem. The problem is coming up with
>> something that not only works for [0.1,0.2..0.5], but also works for
>> [0.1,0.2..1234567890.5].
>> 
>> A good rule of thumb: For every proposal that purports to eliminate
>> having to explicitly take into consideration the limited precision of
>> floating-point representations, there exists a trivial example that
>> breaks that proposal.
>
>If by "trivial" you mean easy to construct, sure.  But if you mean
>typical, that's overstating the case by quite a bit.
>
>There are plenty of perfectly good uses for floating point numbers, as
>long as you keep in mind a few simple rules:

Your "rules" are what I meant by "...having to explicitly take into
consideration the limited precision of floating-point representations."

The problem, of course, is that people would rather not have to follow
any rules, and that floating-point arithmetic would just work the way
they think it ought to.

-Steve Schafer



More information about the Haskell-Cafe mailing list