sign(@number) [ISO]

If the arithmetic value of the argument is negative then -1 is returned, if the value is 0 then 0 is returned, else is 1 returned.

see also: arithmetic in Prolog

Examples
X is sign(-3.9). succeeds, X is -1
X is sign(0). succeeds, X is 0
X is sign(10.9). succeeds, X is 1

 

 

info@trinc-prolog.com