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 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Floating point error [message #34725] Mon, 14 April 2003 19:31
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Kenneth Bowman <k-bowman@null.tamu.edu> writes:
> After a great deal of further mucking around, this appears to be a
> version-dependent bogus error message. It only happens on the Linux
> version 5.6.
...
> % Program caused arithmetic error: Floating illegal operand

Sad as it is, I basically ignore the floating point error messages
that come out of IDL. Their use is close to nil.

Better to check any values that need to be finite and enforce that
constraint, than to rely on error messages that may or may not come
from IDL.

Craig


--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: Floating point error [message #34734 is a reply to message #34725] Mon, 14 April 2003 07:40 Go to previous message
K. Bowman is currently offline  K. Bowman
Messages: 330
Registered: May 2000
Senior Member
After a great deal of further mucking around, this appears to be a
version-dependent bogus error message. It only happens on the Linux
version 5.6.

Ken


IDL> help, data
DATA FLOAT = Array[176779]
IDL> k = WHERE(FINITE(data), count)
% Program caused arithmetic error: Floating illegal operand
IDL> print, count
175800
IDL> print, !version
{ x86 linux unix linux 5.6 Oct 26 2002 32 64}



IDL> help, data$<3>
DATA FLOAT = Array[176779]
IDL> k = where(finite(data), count)
IDL> print, count
175800
IDL> print, !version
{ mipseb IRIX unix IRIX 5.5 Aug 28 2001 32 64}



IDL> help, data
DATA FLOAT = Array[176779]
IDL> kk = where(finite(data), count)
IDL> print, count
175800
IDL> print, !version
{ ppc darwin unix Mac OS X 5.6 Oct 26 2002 32 32}


Ken Bowman
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
------------------------------------------------------------ --------------
  Switch to threaded view of this topic Create a new topic Submit Reply
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: Wed Oct 08 13:44:04 PDT 2025

Total time taken to generate the page: 0.00760 seconds