Availability:Arithmetic function (see is/2)
[ISO]max(+Expr1,
+Expr2)Evaluate to the larger of Expr1 and Expr2. Both
arguments are compared after converting to the same type, but the return
value is in the original type. For example, max(2.5, 3) compares the two
values after converting to float, but returns the integer 3. If both
values are numerical equal the returned max is of the type used for the
comparison. For example, the max of 1 and 1.0 is 1.0 because both
numbers are converted to float for the comparison. However, the special
float -0.0 is smaller than 0.0 as well as the integer 0. If the Prolog
flag float_undefined
is set to nan
and one of the arguments evaluates to NaN,
the result is NaN.
The function maxr/2
is similar, but uses exact (rational) comparision if Expr1
and Expr2 have a different type, propagate the rational
(integer) rather and the float if the two compare equal and propagate
the non-NaN value in case one is NaN.