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

Home » Public Forums » archive » Re: Floating point error
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Floating point error [message #34740 is a reply to message #34734] Sat, 12 April 2003 13:20 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Kenneth Bowman <k-bowman@null.tamu.edu> writes:

> I am trying to scatter a vector "data" into an array "array" using array
> subscripts. "data" contains some NaNs.
>
> This causes floating point exceptions, even though no "operation" is
> taking place.
>
> IDL> help, i, j, h, data, array
> I LONG = Array[176779]
> J LONG = Array[176779]
> H LONG = Array[176779]
> DATA FLOAT = Array[176779]
> ARRAY FLOAT = Array[720, 160, 24]
> IDL> array[i,j,h] = data
> % Program caused arithmetic error: Floating illegal operand
> IDL> q = data ;Copy data
> IDL> q[*] = 0.0 ;Get rid of NaNs
> IDL> array[i,j,h] = q ;No problem
>
> If this is a feature, it is going to make using NaNs very difficult.

How about,
wh = where(finite(data), ct)
if ct GT 0 then array(i(wh), j(wh), h(wh)) = data(wh)

If you have repeats in your I,J,H data, and you want to sum over those
repeats, then you should use the dirty tricks that JD, I, et al. have
discussed in the past, primarily using the evil HISTOGRAM.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Using NO_COPY with pointers
Next Topic: RST transform in ENVI 3.2

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

Current Time: Fri Oct 10 06:14:38 PDT 2025

Total time taken to generate the page: 0.72595 seconds