really small values

Gary Herron gherron at islandtraining.com
Tue Jul 17 18:21:45 EDT 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?
>
> Thanks!
> Dee
>
>
>   
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/

Good luck,

Gary Herron




More information about the Python-list mailing list