Fernando.Perez at colorado.edu
Tue Aug 2 09:54:34 CDT 2005
Pieter Dumon wrote:
> I'm having a problem with exp():
> >>>import Numeric
> >>>a = Numeric.array([-800+0j])*Numeric.ones(10)
> results in"OverflowError: math range error"
> I had expected to get the cmath.exp() result:
> >>> import cmath
> >>> cmath.exp(-800+0j)
> anyone knows what I'm doing wrong ?
Numeric doesn't underflow to zero silently, nor does it offer a way to control
the fpu's exception bits directly. I believe that numarray does offer such
For exponentials of real arguments, I've overridden exp() with my own version:
"""Compute exponentials which safely underflow to zero.
Slow but convenient to use. Note that NumArray will introduce proper
floating point exception handling with access to the underlying
if type(x) is ArrayType:
You can modify this to work with complex inputs.
More information about the Numpy-discussion