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

Home » Public Forums » archive » Turning off math error checking for a code block
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Turning off math error checking for a code block [message #28898] Thu, 17 January 2002 08:26 Go to previous message
k-bowman is currently offline  k-bowman
Messages: 12
Registered: December 2001
Junior Member
I have an array x that is likely to have missing values in it, indicated by NaN's. I would like to search the array for values less than x_min. Because of the NaN's, WHERE generates a floating point error, e.g.,

IDL> print, x
0.00000 NaN 2.00000 3.00000
IDL> print, where(x lt 2.0)
0
% Program caused arithmetic error: Floating illegal operand


As best I understand the interaction between !EXCEPT and CHECK_MATH, in order to suppress this error message, while still checking errors elsewhere in the code, I must do the following:

error = CHECK_MATH(/PRINT) ;If any errors have occurred, print
save_except = !EXCEPT ;Save current exception flag
!EXCEPT = 0 ;Set exception flag to 0
i = WHERE(x LT x_min, ni) ;Find all x < x_min
error = CHECK_MATH() ;Clear accumulated error status
!EXCEPT = save_except ;Restore exception flag

Am I making this harder than it needs to be?

Ken
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Turning off math error checking for a code block
Next Topic: Re: Passing an array from IDL to MPI

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

Current Time: Fri Oct 10 07:41:24 PDT 2025

Total time taken to generate the page: 0.71839 seconds