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

Home » Public Forums » archive » Re: min/max routines
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: min/max routines [message #7403] Wed, 13 November 1996 00:00
meron is currently offline  meron
Messages: 51
Registered: July 1995
Member
In article <328A0DE2.11F@lanl.gov>, Dot Delapp <ddelapp@lanl.gov> writes:
> Is there a routine similar to the fortran and c min max functions
> that returns the max or min of two numbers?
>
You don't need a routine. Given two numbers, a and b, the statement

c = a > b

gives the max of the two, while

c = a < b

gives the min.

Mati Meron | "When you argue with a fool,
meron@cars.uchicago.edu | chances are he is doing just the same"
Re: min/max routines [message #7405 is a reply to message #7403] Wed, 13 November 1996 00:00 Go to previous message
Andy Loughe is currently offline  Andy Loughe
Messages: 174
Registered: November 1995
Senior Member
Dot Delapp wrote:
>
> Is there a routine similar to the fortran and c min max functions
> that returns the max or min of two numbers?
>
> Thanks

Sure!

IDL> a = 40
IDL> b = 45
IDL> print, min([a,b]), max([a,b])
40 45

--
Andrew F. Loughe afl@cdc.noaa.gov
University of Colorado, CIRES http://cdc.noaa.gov/~afl
Campus Box 449 phn:(303)492-0707 fax:(303)497-7013
Boulder, CO 80309-0449 "He who laughs last thinks slowest!"
Re: min/max routines [message #7406 is a reply to message #7403] Wed, 13 November 1996 00:00 Go to previous message
Tim Patterson is currently offline  Tim Patterson
Messages: 65
Registered: October 1995
Member
Dot Delapp wrote:
>
> Is there a routine similar to the fortran and c min max functions
> that returns the max or min of two numbers?
>
> Thanks


For two or more separate numbers, you can use < and > for min/max

Examples:

> print, 1< 2

1

> print, 22 < 1.5 < 3 < 6 < 7

1.5

> temp = 1 > 3 > 2
> print, temp

3


There's more under "Miminum Operator" and "Maximum Operator"
in the IDL manuals.

Hope this helps

Tim
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Inverse of POLYFILLV
Next Topic: Inverse of POLYFILLV

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

Current Time: Wed Oct 08 13:42:48 PDT 2025

Total time taken to generate the page: 0.00496 seconds