[Numpy-discussion] arange and floating point arguments
Sebastian Haase
haase@msg.ucsf....
Fri Sep 14 14:14:47 CDT 2007
On 9/14/07, Charles R Harris <charlesr.harris@gmail.com> wrote:
>
> Since none of the numbers are exactly represented in IEEE floating point,
> this sort of oddity is expected. If you look at the exact values, (.4 +
> .2)/.1 > 6 and .6/.1 < 6 .
Just for my own benefit (and the past time) here are the actual
numbers I get in my PyShell:
>>> 0.6 == (0.4+0.2)
False
>>> `.6`
'0.59999999999999998'
>>> `.4`
'0.40000000000000002'
>>> `.2`
'0.20000000000000001'
>>> `.2+.4`
'0.60000000000000009'
To my naive eye this is just "fantastic" ... ;-)
-Sebastian Haase
PS:you might even notice that "1+2 = 9" ;-)
More information about the Numpy-discussion
mailing list