really small values
John Machin
sjmachin at lexicon.net
Tue Jul 17 18:55:15 EDT 2007
On 18/07/2007 7:13 AM, 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?
>
It is difficult to understand what you mean by xe^-325 etc ... in
Python, ^ is the bitwise exclusive-or operator. The power operator is **
Consider this:
>>> import math
>>> math.exp(-325)
7.1497915694453328e-142
>>>
In other words, e ** (-325) is of the order of 7.15 * 10 ** (-142)
Also consider that the smallest positive number that can be represented
by the (almost universal) IEEE 754 64-bit floating-point representation
is about 10**(-308).
So under one interpretation of "e^-325" (1.0e-325), your result is
already effectively zero; under the other interpretaion (math.exp(-325))
it is nowhere near zero.
Perhaps you had better show us the (no more than 10) lines of actual
runable Python code that demonstrate your problem.
HTH,
John
More information about the Python-list
mailing list