Re: [Haskell-cafe] Bug with [Double]

2010-05-19 Thread Roman Leshchinskiy
On 19/05/2010, at 23:44, Ben Millwood wrote: > On Wed, May 19, 2010 at 10:57 AM, Serguey Zefirov wrote: >> >> PS >> Rationals: >> Prelude> [1,1+2/3..10] :: [Rational] >> [1 % 1,5 % 3,7 % 3,3 % 1,11 % 3,13 % 3,5 % 1,17 % 3,19 % 3,7 % 1,23 % >> 3,25 % 3,9 % 1,29 % 3,31 % 3] >> >> Same result. >

Re: [Haskell-cafe] Bug with [Double]

2010-05-19 Thread Lutz Donnerhacke
* Ben Millwood wrote: >> Prelude> [1,1+2/3..10] :: [Rational] >> [1 % 1,5 % 3,7 % 3,3 % 1,11 % 3,13 % 3,5 % 1,17 % 3,19 % 3,7 % 1,23 % >> 3,25 % 3,9 % 1,29 % 3,31 % 3] >> >> Same result. > > This sounds like a bug to me. The section of the Haskell Report that > deals with the Enum class mentions Fl

Re: [Haskell-cafe] Bug with [Double]

2010-05-19 Thread Ben Millwood
On Wed, May 19, 2010 at 10:57 AM, Serguey Zefirov wrote: > > PS > Rationals: > Prelude> [1,1+2/3..10] :: [Rational] > [1 % 1,5 % 3,7 % 3,3 % 1,11 % 3,13 % 3,5 % 1,17 % 3,19 % 3,7 % 1,23 % > 3,25 % 3,9 % 1,29 % 3,31 % 3] > > Same result. This sounds like a bug to me. The section of the Haskell Rep

Re: [Haskell-cafe] Bug with [Double]

2010-05-19 Thread Roman Leshchinskiy
On 19/05/2010, at 20:36, Ivan Lazar Miljenovic wrote: > Roman Leshchinskiy writes: >> Personally, I consider the Enum class itself to be broken. > > Oh? In what sense? Firstly, the enumFrom* family of functions shouldn't be methods and the class itself should provide enough facilities for imp

Re: [Haskell-cafe] Bug with [Double]

2010-05-19 Thread Ivan Lazar Miljenovic
Roman Leshchinskiy writes: > Personally, I consider the Enum class itself to be broken. Oh? In what sense? It seems to work fine for data types representing bounded enumerable values with a proper mapping to/from Int (it's not bijective since there's no proper mapping from Int -> Bool for examp

Re: [Haskell-cafe] Bug with [Double]

2010-05-19 Thread Roman Leshchinskiy
On 19/05/2010, at 19:24, Dmitry Olshansky wrote: > Prelude> [1,1+2/3..10] > [1.0,1.6665,2.333,2.9996,3.666,4.332,4.998,5.664,6.33,6.9964,7.6625,8.329,8.99

Re: [Haskell-cafe] Bug with [Double]

2010-05-19 Thread Dmitry Olshansky
Thanks, it's clear now. 2010/5/19 Serguey Zefirov : > 2010/5/19 Erik de Castro Lopo : >> Dmitry Olshansky wrote: >> >>> It seems that I saw something like this in Cafe recevtly. But I am not >>> sure... >>> In GHC 6.12.1 (Platform 2010 on Windows Vista) I have >> >> >> >> >>> Any comments? >> >>

Re: [Haskell-cafe] Bug with [Double]

2010-05-19 Thread Dmitry Olshansky
But Prelude Data.List> [1,1+2/3..4] :: [Double] [1.0,1.6665,2.333,2.9996,3.666,4.332] Prelude Data.List> unfoldr (\n -> let n'=n+2/3 in if n' <= 4 then Just (n',n') else Nothing) 1 :: [Double] [1.6665,2.333,2.

Re: [Haskell-cafe] Bug with [Double]

2010-05-19 Thread Ivan Lazar Miljenovic
Ivan Lazar Miljenovic writes: > Dmitry Olshansky writes: > >> Hello all, >> >> It seems that I saw something like this in Cafe recevtly. But I am not >> sure... >> In GHC 6.12.1 (Platform 2010 on Windows Vista) I have >> >> Prelude> [1,1+2/3..10] >> [1.0,1.6665,2.333,2.9

Re: [Haskell-cafe] Bug with [Double]

2010-05-19 Thread Serguey Zefirov
2010/5/19 Erik de Castro Lopo : > Dmitry Olshansky wrote: > >> It seems that I saw something like this in Cafe recevtly. But I am not >> sure... >> In GHC 6.12.1 (Platform 2010 on Windows Vista) I have > > > > >> Any comments? > > The problem you point out is not a problem with Haskell, but a pro

Re: [Haskell-cafe] Bug with [Double]

2010-05-19 Thread Ivan Lazar Miljenovic
Dmitry Olshansky writes: > Hello all, > > It seems that I saw something like this in Cafe recevtly. But I am not sure... > In GHC 6.12.1 (Platform 2010 on Windows Vista) I have > > Prelude> [1,1+2/3..10] > [1.0,1.6665,2.333,2.9996,3.666,4.33

Re: [Haskell-cafe] Bug with [Double]

2010-05-19 Thread Erik de Castro Lopo
Dmitry Olshansky wrote: > It seems that I saw something like this in Cafe recevtly. But I am not sure... > In GHC 6.12.1 (Platform 2010 on Windows Vista) I have > Any comments? The problem you point out is not a problem with Haskell, but a problem with the whole concept of floating point arit

[Haskell-cafe] Bug with [Double]

2010-05-19 Thread Dmitry Olshansky
Hello all, It seems that I saw something like this in Cafe recevtly. But I am not sure... In GHC 6.12.1 (Platform 2010 on Windows Vista) I have Prelude> [1,1+2/3..10] [1.0,1.6665,2.333,2.9996,3.666,4.332,4.998,5.6