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

Home » Public Forums » archive » NaN problem in integer arrays
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
NaN problem in integer arrays [message #86206] Thu, 17 October 2013 08:44 Go to previous message
galaxytraveler42 is currently offline  galaxytraveler42
Messages: 5
Registered: October 2013
Junior Member
I use NaN's a lot in my arrays in place of missing or bad data points, but I have problems with it everytime my arrays are integer.

An example of a test program:
x=[0,1,2,0]
s=where(x EQ 0,count)
if count gt 0 then x(s)=!Values.F_NAN
help, X

> X INT = Array[4]

print, X
> % Stop encountered: test.pro
> % Program caused arithmetic error: Floating illegal operand



And if I change it to a long array:
x=long(x)
then I get:
> X LONG = Array[4]
> -2147483648 1 2 -2147483648
> % Program caused arithmetic error: Floating illegal operand



But if I do this with a floating array.
x=[0.,1.,2.,0.]
Then it works just fine
> X FLOAT = Array[4]
> NaN 1.00000 2.00000 NaN



I can see that other people have had troubles with this and explained it as a windows compiler errors, but I have a mac computer.
http://www.idlcoyote.com/math_tips/nans.html


Do anyone know if there is a solution for this?
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Interactively crop an image with NG
Next Topic: Test if a linux command is available with Spawn

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

Current Time: Wed Oct 08 13:58:13 PDT 2025

Total time taken to generate the page: 0.00500 seconds