[SciPy-dev] Have divide by zero handling changed lately?
Otto Tronarp
otto@tronarp...
Thu Mar 22 13:11:46 CDT 2007
Hello,
have numpy's handling of divide by zero changed lately?
import numpy
numpy.seterr(divide='warn')
v = numpy.asarray([0, 1], dtype='d')
print 1/numpy.asarray([0], dtype='d')
print 1/v
print 1.0/v[0]
In the code above 1.0/v[0] doesn't generate a warning, that can't be right?
While writing this I actually tried some more things:
1.0/numpy.float32(0) has correct behavior (generates a warning)
whereas 1.0/numpy.float64(0) silently gives us an inf.
This is with
In [95]:numpy.__version__
Out[95]:'1.0.1'
on a
i686 AMD Sempron(tm) 2600+ AuthenticAMD GNU/Linux
Regards,
Otto
More information about the Scipy-dev
mailing list