[Numpy-discussion] numpy migration

Timothy Hochberg tim.hochberg@ieee....
Tue Apr 24 12:45:24 CDT 2007


On 4/24/07, Timothy Hochberg <tim.hochberg@ieee.org> wrote
[CHOP]

Sorry, cut and paste error, that should have  read:

:

>
> >
> > >>> i = a[0,0]
> > >>> 1/i
> >
> > 0
>
>
> You should be getting a warning here. Did one disappear in the cut and
> paste? Or are you using a nonstandard shell that eats warnings? Or an old
> version of numpy?
>
> In any event if you want an error rather than a warning for zero division,
> use seterr:
>
> >>> 1/i
> Warning: divide by zero encountered in long_scalars
> 0
> >>> N.seterr(divide='raise')
> {'over': 'print', 'divide': 'print', 'invalid': 'print', 'under':
> 'ignore'}
> >>> 1/i
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> FloatingPointError: divide by zero encountered in long_scalars
>
> Although I'm not sure why that's a floating point error.
>


[CHOP]

-- 

//=][=\\

tim.hochberg@ieee.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070424/bb3b73d3/attachment.html 


More information about the Numpy-discussion mailing list