I apologize for the really simple and dumb question; however, why is there a difference in precision displayed for these two cases?
1)
>> test = numpy.array([0.22])
>> test2 = test[0] * 2
>> test2
0.44
2)
>> test = numpy.array([0.24])
>> test2 = test[0] * 2
>> test2
0.47999999999999998
I'm using python2.6.6 on 64-bit linux. Thank you in advance for your help.
This also hold seems to hold for a list in python
>>> t = [0.22]
>>> t
[0.22]
>>> t = [0.24]
>>> t
[0.23999999999999999]
See Question&Answers more detail:os