Section "magnitude"

We support predicates that compare numbers by their magnitude, looking only at the value and not at the type. This is in contrast to Prolog unification (=)/2 or Prolog syntactic equality (==)/2 which both take the value and the type into account, whereas (=:=)/2 does convert integer arguments to float before comparison, if at least one argument is float.

The following magnitude evaluable functions are provided:

abs(A, B): [ISO 9.1.7]
The predicate succeeds in B with the absolute value of A.
sign(A, B): [ISO 9.1.4]
The predicate succeeds in B with the sign of A.
min(A, B, C): [TC2 9.3.9]
The predicate succeeds in C with the minimum of A and B.
max(A, B, C): [TC2 9.3.8]
The predicate succeeds in C with the maximum of A and B.
truncate(A, B): [ISO 9.1.7]
The predicate succeeds in B with the truncate of A.
floor(A, B): [ISO 9.1.7]
The predicate succeeds in B with the floor of A.
ceiling(A, B): [ISO 9.1.7]
The predicate succeeds in B with the ceiling of A.
round(A, B): [ISO 9.1.7]
The predicate succeeds in B with the rounding of A.

The following magnitude predicates are provided:

X =:= Y: [ISO 8.7.1]
The predicate succeeds when X number equals Y, otherwise fails.
X =\= Y: [ISO 8.7.1]
The predicate succeeds when X does not number equal Y, otherwise fails.
X < Y: [ISO 8.7.1]
The predicate succeeds when X is number less than Y, otherwise fails.
X >= Y: [ISO 8.7.1]
The predicate succeeds when X is number greater or equal to Y, otherwise fails.
X > Y: [ISO 8.7.1]
The predicate succeeds when X is number greater than Y, otherwise fails.
X =< Y: [ISO 8.7.1]
The predicate succeeds when X is number less or equal to Y, otherwise fails.

Kommentare