Functions

The following arithmetic functions are predefined in PrologJ. A function will be evaluated if it occurs on the right hand side of is/2 or on either side of the arithmetic comparison operations (=:=, =\=, >, >=, < or =<).

Binary functions

Name   Description
+Arithmetic addition.
/\Bitwise logical and for integers.
\/Bitwise logical or for integers.
/Arithmetic division. Whether real number division is done even when the operands are integers depends on the setting of the $operator_single_slash flag.
//Integer division.
<<Bitwise left shift for integers.
modInteger modulus.
**Arithmetic power.
remInteger remainder.
>>Bitwise right shift for integers.
-Arithmetic subtraction.
*Arithmetic multiplication.

Unary functions

Name   Description
absAbsolute value.
atanTrignometric arctangent.
\Bitwise logical complement for integers.
ceilingArithmetic ceiling. Result always an integer.
cosTrignometric cosine.
expArithmetic exponential.
floatConvert to a real.
float_fractional_partFractional part of a real number.
float_integer_partInteger part of a real number - but still a real.
floorArithmetic floor. Result always an integer.
logNatural logarithm.
-Arithmetic negation.
roundRound to the nearest integer.
signArithmetic signum - result always -1, 0, or 1.
sinTrignometric sine.
sqrtArithmetic square root. Result always real.
truncateTruncate to integer.

Zeroary functions

Name   Description
ee - the base of natural logarithms.
pipi.
randomA random number in the range [0.0..1.0)