comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » odd behaviour from array_equal() with NaN, Inf values
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
odd behaviour from array_equal() with NaN, Inf values [message #79039] Sun, 22 January 2012 20:42
wallabadah is currently offline  wallabadah
Messages: 28
Registered: November 2005
Junior Member
I've come across the following behaviour while tracking down odd behaviour from NaN and Inf values. I'm trying to use array_equal() to check that arrays contain the same content - but it bombs when the arrays contain NaN. I've tracked it down to the process of copying an array containing NaN values to a new variable. For example:

IDL> a = findgen(5)
IDL> a[1] = !values.f_nan
IDL> print, array_equal(a, a)
1
IDL> b = a
IDL> print, array_equal(a, b)
0
IDL> print, array_equal(b, b)
1

Repeating the process with !values.f_infinity behaves as expected:

IDL> a = findgen(5)
IDL> a[1] = !values.f_infinity
IDL> print, array_equal(a, a)
1
IDL> b = a
IDL> print, array_equal(a, b)
1
IDL> print, array_equal(b, b)
1

Is this a bug in make_array() or some artifact of how values are copied to new variables?? Is it reproducible on different platforms (I'm on Mac OS X, IDL 8.1).

thanks in advance,

Will
[Message index]
 
Read Message
Previous Topic: Re: ps_star.pro no found on IDL71?
Next Topic: Cramér–von Mises criterion

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 10:06:29 PDT 2025

Total time taken to generate the page: 7.75969 seconds