[Python-Dev] Expert floats
Josiah Carlson
jcarlson at uci.edu
Tue Mar 30 14:16:53 EST 2004
> That doesn't make sense to me. If the .py file says "1.1" and the
> .pyc file says "1.1", you're going to get the same results.
>
> In fact, you've just given a stronger reason for keeping "1.1".
> Currently, compiling a .py file containing "1.1" produces a .pyc file
> containing "1.1000000000000001". .pyc files are supposed to be
> platform-independent. If these files are then run on a platform with
> different floating-point precision, the .py and the .pyc will produce
> different results.
I believe (please correct me if I'm wrong), that Python floats, on all
platforms, are IEEE 754 doubles. That is, Python uses the 8-byte FP,
not the (arguably worthless) 4-bit FP. Cross-platform precision is not
an issue.
- Josiah
More information about the Python-Dev
mailing list