[ Arithmetic | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

min(+Number1, +Number2, ?Minimum)

Unifies the minimum of Number1 and Number2 with Minimum.
+Number1
A number.
+Number2
A number.
?Minimum
A variable or a number.

Description

This predicate is used by the ECLiPSe compiler to expand evaluable arithmetic expressions. So the call to min(Number1, Number2, Minimum) is equivalent to
	Minimum is min(Number1, Number2)
which should be preferred for portability.

In coroutining mode, if Number1 or Number2 are free variables, the call to min/3 is delayed until these variables are instantiated.

Fail Conditions

Fails if the result of the evaluation does not unify with Minimum.

Resatisfiable

No

Exceptions

(4) instantiation fault
Number1 or Number2 is not instantiated (non-coroutining mode only).
(5) type error
Result is of a different type than the evaluation result.
(24) number expected
Number1 or Number2 is not of a numeric type.
(24) number expected
Result is neither a number nor a variable.

Examples

Success:
      min(5, 2, 2).
      min(2_3, 3_4, 2_3).
      min(5.0 , 2.0, 2.0).
      min(5.0, 2, 2.0).         (The types are adjusted)
      min(5_0, 2, 2_0).         (The types are adjusted)
Fail:
      min(1, 2, 3).
Error:
      min(A, 2, 6).             (Error 4).
      min(1, 2, 2.0).           (Error 5).
      min(5, 2.0, 5).           (Error 5).
      min(4 - 2, 3, 3).         (Error 24).
      min(5, 2, r).             (Error 24).



See Also

is / 2