On Fri, Jan 14, 2011 at 12:03 PM, Joon Ro <joonp...@gmail.com> wrote:
> Hi,
> I was wondering if it is possible to process (in if statement - check if the
> given value is NaN) numpy NaN value inside the weave.inline c code.
>
> testcode = '''
> if (test(0)) {
>       return_val = test(0);
> }
> '''
>
> err = weave.inline(testcode,
>  ['test'],
> type_converters = converters.blitz, force = 0, verbose = 1)
>
>
> with test(0) = nan returns err = nan correctly, but I don't know how to
> check the nan value inside the c inline c code. Is there any way I can get
> similar functionality as isnan?

To check if a scalar, x, is NaN:

if x == x:
    # No, it is not a NaN
else:
    # Yes, it is a NaN
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to