Re: [Haskell-cafe] instance Enum Double considered notentirelygreat?

2011-09-27 Thread Donn Cave
Quoth Chris Smith cdsm...@gmail.com, ... So that's what this is about: do we think of Float as an approximate real number type, or as an exact type with specific values. If the latter, then of course you exclude the value that's larger than the upper range. If the former, then using

Re: [Haskell-cafe] instance Enum Double considered notentirelygreat?

2011-09-27 Thread Chris Smith
On Tue, 2011-09-27 at 00:29 -0700, Donn Cave wrote: It doesn't appear to me to be a technicality about the representation - the value we're talking about excluding is not just represented as greater than 0.3, it is greater than 0.3 when applied in computations. Sure, the exact value is greater

Re: [Haskell-cafe] instance Enum Double considered notentirelygreat?

2011-09-27 Thread Iavor Diatchki
Hello, On Tue, Sep 27, 2011 at 8:49 AM, Chris Smith cdsm...@gmail.com wrote: You could calculate the entire range using Rational and then convert each individual value after the fact.  That doesn't seem like a reasonable default, since it has a runtime performance cost.  Of course you're

Re: [Haskell-cafe] instance Enum Double considered notentirelygreat?

2011-09-27 Thread Ketil Malde
Iavor Diatchki iavor.diatc...@gmail.com writes: last ([0.1, 0.2 .. 0.5]) == 0.5 False last (map fromRational [0.1, 0.2 .. 0.5]) == 0.5 True As Ross pointed out in a previous e-mail the instance for Rationals is also broken: last (map fromRational [1,3 .. 20]) 21.0 But only because it

Re: [Haskell-cafe] instance Enum Double considered notentirelygreat?

2011-09-27 Thread Chris Smith
On Tue, 2011-09-27 at 09:47 -0700, Iavor Diatchki wrote: As Ross pointed out in a previous e-mail the instance for Rationals is also broken: last (map fromRational [1,3 .. 20]) 21.0 Sure, for Int, Rational, Integer, etc., frankly I'd be in favor of a runtime error when the last value