[Numpy-discussion] Re: sqrt and divide

Alan G Isaac aisaac at american.edu
Wed Apr 12 06:11:11 CDT 2006


> Stefan van der Walt wrote: 
>> In [8]: N.divide(1,0)
>> Out[8]: 0
>> should probably ruturn inf / nan?) 


On Wed, 12 Apr 2006, Robert Kern apparently wrote: 
> inf and nan are floating point values. The definition of 
> int division used when both arguments to divide() are ints 
> also yields ints, not floats. 


But the Python behavior seems better for this case.

    >>> 1/0
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
    ZeroDivisionError: integer division or modulo by zero

fwiw,
Alan Isaac







More information about the Numpy-discussion mailing list