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

Home » Public Forums » archive » Re: Division in a conditional 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: Division in a conditional statement [message #36287 is a reply to message #36282] Sat, 30 August 2003 08:46 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Hassan Iqbal writes:

> Can anybody tell me what does this mean:
>
> x= a LT total(abs(b))/1e7/NFREE
>
> where:
> b= an array of floating point numbers
> a= a floating point number
> NFREE= an integer
>
> I will be very much thankful. I really need to understand this.

This means that the person who wrote this code
was overly concerned with job security and was
trying to write code only he could decipher.
Either that or he had a sadistic personality, but
I prefer the kinder interpretation. :-)

To interpret this code, you have to have an
understanding of "operator precedence" (you
could look this up on IDL's on-line help).

Parentheses have the highest or first order of precedence
(and your code writer should have used them to
give meaning to this expression). Followed by
multiplication and division operators (fourth
highest order), and followed up by the LT operator,
which has the sixth highest order of pprecedence.

So, everything to the right of the "LT" operator
happens first and a result is stored in a temporary
variable. Then this result is compared to A with the
LT operator. A couple of parentheses would have made
this plain:

x= a LT (total(abs(b))/1e7/NFREE)

Operators of the same order of precedence, by the way,
are handled left to right.

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Pause the program
Next Topic: mpeg resolution in MS-Windows

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

Current Time: Sun Oct 12 03:56:33 PDT 2025

Total time taken to generate the page: 0.24805 seconds