Can't exponentiate zero in NumPy
Rick Muller
rpm at wag.caltech.edu
Mon Sep 9 13:40:32 EDT 2002
Tim Peters wrote:
>
> Does this require wrapping in a Numeric array, or does it also happen in
> *any* of these straight Python expressions?:
Turns out it appears to be a more general problem than I thought.
>
> 1e-310 ** 2
Works on RH linux/1.5.2, overflows on RH linux 2.2
> pow(1e-310, 2)
Works on linux 1.5.2, overflows on linux 2.2
> import math
> math.pow(1e-310, 2)
Works on linux 1.5.2, works on linux 2.2 (??!)
>
> 1e-310 ** 2.1
Works on linux 1.5.2, fails on linux 2.2
> pow(1e-310, 2.1)
Works on linux 1.5.2, fails on linux 2.2
> math.pow(1e-310, 2.1)
>
Works on linux 1.5.2, works on linux 2.2
> In addition, exactly which version of Python are you using (2.0, 2.1, 2.1.1,
> 2.1.2, 2.1.3, 2.2, 2.2.1, ...)?
These are the standard python/python2 distributed with RedHat Linux 7.3.
"Works" means returns 0.0
"Fails" means raises an OverflowError
Can someone suggest a decent workaround?
Rick
More information about the Python-list
mailing list