[ Arithmetic | Reference Manual | Alphabetic Index ]
max(+Number1, +Number2, -Result)
-Result is max(+Number1, +Number2)
Unifies the maximum of Number1 and Number2 with Maximum.
- Number1
- A number.
- Number2
- A number.
- Maximum
- Output: number.
Description
Unifies the maximum of Number1 and Number2 with Maximum.
This predicate can be used as a function in arithmetic expressions.
In coroutining mode, if Number1 or Number2 are uninstantiated, the call
to max/3 is delayed until these variables are instantiated.
Modes and Determinism
Exceptions
- (4) instantiation fault
- Number1 or Number2 is not instantiated (non-coroutining mode only).
- (24) number expected
- Number1 or Number2 is not of a numeric type.
Examples
Result is max(5, 2). % gives Result = 5
Result is max(2_3, 3_4). % gives Result = 3_4
Result is max(5.0, 2.0). % gives Result = 5.0
Result is max(5, 2.0). % gives Result = 5.0 (the types are adjusted)
Result is max(5, 2_0). % gives Result = 5_0 (the types are adjusted)
See Also
is / 2