Hi,
I've just started using Python, and am having an extraordinary experience.
One thing worries me, however, I'm planning on doing some mathematical
research with Python, and it appears that it does funny thing with
floating point numbers.. Maybe It's superficial, but here's what I'm
getting,using the interpreter..[color=blue][color=green][color=darkred]
>>> .31[/color][/color][/color]
0.31[color=blue][color=green][color=darkred]
>>> .32[/color][/color][/color]
0.3200000000000 0001[color=blue][color=green][color=darkred]
>>> .33[/color][/color][/color]
0.3300000000000 0002[color=blue][color=green][color=darkred]
>>> .34[/color][/color][/color]
0.3400000000000 0002[color=blue][color=green][color=darkred]
>>> .35[/color][/color][/color]
0.3499999999999 9998[color=blue][color=green][color=darkred]
>>> .21[/color][/color][/color]
0.2099999999999 9999[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
Now, I realize that this is really small errors.. Does anybody have an
explanation why Python picks up or loses these?
Thanks
Todd
I've just started using Python, and am having an extraordinary experience.
One thing worries me, however, I'm planning on doing some mathematical
research with Python, and it appears that it does funny thing with
floating point numbers.. Maybe It's superficial, but here's what I'm
getting,using the interpreter..[color=blue][color=green][color=darkred]
>>> .31[/color][/color][/color]
0.31[color=blue][color=green][color=darkred]
>>> .32[/color][/color][/color]
0.3200000000000 0001[color=blue][color=green][color=darkred]
>>> .33[/color][/color][/color]
0.3300000000000 0002[color=blue][color=green][color=darkred]
>>> .34[/color][/color][/color]
0.3400000000000 0002[color=blue][color=green][color=darkred]
>>> .35[/color][/color][/color]
0.3499999999999 9998[color=blue][color=green][color=darkred]
>>> .21[/color][/color][/color]
0.2099999999999 9999[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
Now, I realize that this is really small errors.. Does anybody have an
explanation why Python picks up or loses these?
Thanks
Todd
Comment