really small values
gherron at islandtraining.com
Wed Jul 18 00:21:45 CEST 2007
Dee Asbury wrote:
> In multiplying a value of xe^-325 with ye^-4, Python is returning zero. How
> do I get it to give me back my tiny value?
Of course, Python is doing no such thing. The floating point
arithmetic hardware on your machine is doing the multiplication and
giving that result. Different hardware would probably not solve the
problem as almost all hardware these days uses the IEEE spec for
floating point numbers. In that spec, a 64bit floating point value has
a lower limit on the exponent that you are running into.
However, there are software packages that represent numbers (integer and
floating point) with larger collections of bit.
Try looking at GMP at for one such package: http://gmplib.org/
More information about the Python-list