[Numpy-discussion] Infinity definitions

Zachary Pincus zachary.pincus@yale....
Wed Jul 16 08:16:12 CDT 2008


>> Hi,
>> Following Travis's suggestion below, I would like to suggest that the
>> following definitions be depreciated or removed in this forthcoming
>> release:
>>
>> numpy.Inf
>> numpy.Infinity
>> numpy.infty
>> numpy.PINF
>> numpy.NAN
>> numpy.NaN
> ...
>
> While this is being discussed, what about the "representation" of
> nan's an infinities produced by repr in various forms?  It is
> particularly annoying when the repr of simple numeric types cannot be
> evaluated.  These include:
>
> 'infj'    == repr(complex(0,inf))
> 'nanj'    == repr(complex(0,nan))
> 'infnanj' == repr(complex(inf,nan))
> 'nannanj' == repr(complex(nan,nan))
>
> It seems that perhaps infj and nanj should be defined symbols.  I am
> not sure why a + does not get inserted before nan.
>
> In addition, the default infstr and nanstr printing options should
> also be changed to 'inf' and 'nan'.

Hello all,

If I recall correctly, one reason for the plethora of infinity  
definitions (which had been mentioned previously on the list) was that  
the repr for some or all float/complex types was generated by code in  
the host OS, and not in numpy. As such, these reprs were different for  
different platforms. As there was a desire to ensure that reprs could  
always be evaluated, the various ways that inf and nan could be spit  
out by the host libs were all included.

Has this been fixed now, so that repr(inf), (etc.) looks identical on  
all platforms?

Zach


More information about the Numpy-discussion mailing list