[ Arithmetic | Reference Manual | Alphabetic Index ]

min(+Number1, +Number2, -Result)

-Result is min(+Number1, +Number2)

Unifies the minimum of Number1 and Number2 with Minimum.
Number1
A number.
Number2
A number.
Minimum
Output: a number.

Description

Unifies the minimum of Number1 and Number2 with Minimum.

This predicate can be used as a function in arithmetic expressions. In coroutining mode, if Number1 or Number2 are uninstantiated, the call to min/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 min(5, 2).	% gives Result = 2
    Result is min(2_3, 3_4).	% gives Result = 2_3
    Result is min(5.0, 2.0).	% gives Result = 2.0
    Result is min(5.0, 2).	% gives Result = 2.0 (the types are adjusted)
    Result is min(5_0, 2).	% gives Result = 2_0 (the types are adjusted)

See Also

is / 2