[Numpy-discussion] Can numpy catch this error for me?
Tue Apr 7 15:58:08 CDT 2009
On Tue, Apr 7, 2009 at 15:27, Nathaniel Peterson
> Thanks for the quick response.
> In http://www.scipy.org/Cookbook/Indexing
> I see
>>>> a = C[1,2,3]
> <type 'numpy.int32'>
> <type 'int'>
> Warning: overflow encountered in long_scalars
> This shows numpy can catch an overflow generated by a**a.
> Why is it that numpy can catch this overflow,
> but can not catch one generated by np.multiply.reduce?
Unlike true floating point errors (where the hardware FPU sets a flag
whenever it does an atomic operation that overflows), we need to
implement the integer overflow detection ourselves. We do it on the
scalars, but not arrays because it would be too slow to implement for
every atomic operation on arrays.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion