I found:
IDLE 1.2.2
>>> x = 157.73
>>> r = x * 100.
>>> int(r)
15772
Can I convert more precise?
I found:
IDLE 1.2.2
>>> x = 157.73
>>> r = x * 100.
>>> int(r)
15772
Can I convert more precise?
>>> int(round(r))
15773
The way floating point numbers are represented in many computer languages leads to roundoff errors. Take a look at this ...
q = [157.73 * 100.0]
print q # [15772.999999999998]
# this explains why
print int(157.73 * 100.0) # gives 15772
For really high precision math that prepresents floating point numbers differently use the Python module decimal.
thanks