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

Home » Public Forums » archive » HELP with IF statement
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: HELP with IF statement [message #91271 is a reply to message #91268] Thu, 25 June 2015 05:22 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
g.nacarts@gmail.com writes:

> I have a problem with IF statement
>
> I wanted to check whether my array A has any zero element and if so then simply return a zero array (with two zeroes). I typed the following but am not sure if it's correct.
>
> A FLOAT = Array[58]
>
> FOR i=0L, 57 DO BEGIN
> IF A[i] EQ 0 THEN RETURN, [0,0]
> ENDFOR

There are a whole host of articles on my web page explaining why it will
be impossible to find a zero value in an array of floats. I'll just give
you the bottom line: use Floats_Equal from the Coyote Library to do this
kind of comparison:

IF Floats_Equal(a[i],0) THEN RETURN, [0,0]

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: BYTSCL function
Next Topic: IDL Site Issues

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

Current Time: Wed Oct 08 17:51:27 PDT 2025

Total time taken to generate the page: 0.00497 seconds