Saturday, 9 February 2019

seeing the true value of a float in a python program

The python cmd line shows the true value of a float readily

>>> 1.5-1.4
0.10000000000000009

The obvious way to see it from within a python program is to print it

>>> print 1.5-1.4
0.1

which seems to automatically round it? Is there a way to see the true value of a float from within a program?



from seeing the true value of a float in a python program

No comments:

Post a Comment