Re: if evaluation [message #67351] |
Wed, 15 July 2009 06:32 |
Alessio
Messages: 2 Registered: July 2009
|
Junior Member |
|
|
David Fanning ha scritto:
> Alessio writes:
>
>> I need to understand how line below is evaluated in pv-wave, because I
>> must convert it to C.
>>
>> AND abs(rg(w)-rg(index)) LT (50<rg(index)>20)
>>
>> This line is a part of an "if" condition.
>>
>> The trouble part is "(50<rg(index)>20)".
>> How this part is evaluated ?
>> Supposing rg(index) is 15, the condition will be evaluated in ?
>
> The statement is evaluated left to right.
>
> Compare 50 and rg(index) and take the smaller
> of those two values. Take that value and
> compare it with 20 and take the larger of
> those two values.
>
> Here is an article on precedence:
>
> www.dfanning.com/misc_tips/precedence.html
>
> Cheers,
>
> David
>
>
Thank you,
Alessio
|
|
|
Re: if evaluation [message #67356 is a reply to message #67351] |
Wed, 15 July 2009 05:27  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Alessio writes:
> I need to understand how line below is evaluated in pv-wave, because I
> must convert it to C.
>
> AND abs(rg(w)-rg(index)) LT (50<rg(index)>20)
>
> This line is a part of an "if" condition.
>
> The trouble part is "(50<rg(index)>20)".
> How this part is evaluated ?
> Supposing rg(index) is 15, the condition will be evaluated in ?
The statement is evaluated left to right.
Compare 50 and rg(index) and take the smaller
of those two values. Take that value and
compare it with 20 and take the larger of
those two values.
Here is an article on precedence:
www.dfanning.com/misc_tips/precedence.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|