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
=<
).
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. |
mod | Integer modulus. |
** | Arithmetic power. |
rem | Integer remainder. |
>> | Bitwise right shift for integers. |
- | Arithmetic subtraction. |
* | Arithmetic multiplication. |
Name | Description |
---|---|
abs | Absolute value. |
atan | Trignometric arctangent. |
\ | Bitwise logical complement for integers. |
ceiling | Arithmetic ceiling. Result always an integer. |
cos | Trignometric cosine. |
exp | Arithmetic exponential. |
float | Convert to a real. |
float_fractional_part | Fractional part of a real number. |
float_integer_part | Integer part of a real number - but still a real. |
floor | Arithmetic floor. Result always an integer. |
log | Natural logarithm. |
- | Arithmetic negation. |
round | Round to the nearest integer. |
sign | Arithmetic signum - result always -1, 0, or 1. |
sin | Trignometric sine. |
sqrt | Arithmetic square root. Result always real. |
truncate | Truncate to integer. |
Name | Description |
---|---|
e | e - the base of natural logarithms. |
pi | pi. |
random | A random number in the range [0.0..1.0) |