[pypy-dev] numpypy: could NaN be added?

Maciej Fijalkowski fijall at gmail.com
Sat Jan 21 12:48:49 CET 2012


On Sat, Jan 21, 2012 at 1:25 PM, Dmitrey <dmitrey15 at ukr.net> wrote:
> On 01/21/2012 01:21 PM, Dmitrey wrote:
>>
>> hi all,
>>
>> absence of numpypy.nan prevents creating lots of highly important funcs
>> like isnan, nanmin, nanmax, nanargmin, nanargmax, nansum etc. I cannot
>> guarantee I would immediately provide them, especially for multidimensional
>> arrays, but, at least, I (or other programmers) could create temporary
>> replacements for the absent yet funcs in their own code (for example, only
>> for 1-dimensional or at most 2-dimensional arrays), making their code
>> working in PyPy right now.
>>
>> So could you put the number into numpypy, or there are some difficult
>> problems with it?
>
> I see nan is somehow present in pypy code, but I cannot acces it from
> neither numpypy nor pypy:
>>>>> a = np.inf - np.inf
>>>>> a
> nan
>>>>> type(a)
> <type 'float'>
>>>>> nan
> Traceback (most recent call last):
>  File "<console>", line 1, in <module>
> NameError: global name 'nan' is not defined
>>>>> np.nan
> Traceback (most recent call last):
>  File "<console>", line 1, in <module>
> AttributeError: 'module' object has no attribute 'nan'
>
> -----------------------
> Regards, D.
> http://openopt.org/Dmitrey
>
> _______________________________________________
> pypy-dev mailing list
> pypy-dev at python.org
> http://mail.python.org/mailman/listinfo/pypy-dev

float('nan') works if you want. It's super-trivial to provide it from
numpy as well


More information about the pypy-dev mailing list