abs(@number) [ISO]

This arithmetic predicate returns the absolute value of the argument. If the number is positive then the same number is returned, if the number is negative then the same value is returned without the negative sign.

see also: arithmetic in Prolog is/2

Examples
X is abs(1.1). succeeds, X is  1.1
X is abs(-100). succeeds, X is 100
X is abs(-12.2). succeeds, X is 12.2

 

 

info@trinc-prolog.com