MAX function

Purpose

Return the argument with the largest (maximum) value.

Syntax

y  = MAX(arg [, arg] ...)

y& = MAX&(arg& [, arg&] ...)

y$ = MAX$(arg$ [, arg$] ...)

Remarks

These functions take any number of arguments and return the argument with the largest (maximum) value.  MAX handles arguments of any numeric type.

MAX& handles arguments which evaluate to Long-integers (MAX& is more efficient than MAX).

MAX$ handles string arguments.

If any arguments of MAX& are outside of the range of Long-integers, the result is undefined.  Any floating-point arguments of MAX& will be rounded to Long-integers before the comparison begins.

MAX% is recognized as a valid synonym for MAX&.

See also

CHOOSE, CHOOSE&CHOOSE$IIF, IIF&, IIF$, MIN, MIN&, MIN$, SWITCH, SWITCH&, SWITCH$

Example

x% = MAX&(A, B, C, D)

x$ = MAX$("abacadabra", "cad", A$, B$(4), C$+D$+LEFT$(E$,5))

x## = MAX(1.1@@, A%/B!, C#(x)^D, E##, SIN(F&))