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

Home » Public Forums » archive » Re: "clamping" an array to a maximum value?
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: "clamping" an array to a maximum value? [message #13951 is a reply to message #13941] Mon, 21 December 1998 00:00 Go to previous messageGo to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Kevin Ivory (Kevin@Ivory.de) writes:

> Martin Schultz wrote:
>> ... but be careful to use parantheses when you want to clamp min and
>> max at the same time:
>> twoodle_array = (twoodle_array < max_val ) > min_val
>
> In that case I don't use parantheses either, because I think the
> following "looks" nicer: ;-)
>
> twoodle_array = min_val > twoodle_array < max_val

I agree with Kevin. Having nice looking programs is as important
as having programs that work correctly. :-)

The only problem with Kevin's approach is that I am usually
clamping from some mininum value to some maximun-minus-one
value. And this definitely does NOT do what you want:

twoodle_array = min_val > twoodle_array < max_val - 1

I've been bit so many times with this that I've given up
all aesthetics and wrap those damn parentheses around anything
that moves. :-(

Happy Holidays,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Progamming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: segmentation
Next Topic: 3D Scatter plot

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

Current Time: Sun Oct 12 05:41:18 PDT 2025

Total time taken to generate the page: 1.28175 seconds