YAP 7.1.0

YAP implements several arithmetic functions, they are defined as fields in three enumerations, such that there is one enumeration per each different arity:
More...
YAP implements several arithmetic functions, they are defined as fields in three enumerations, such that there is one enumeration per each different arity:
These are the binary numeric operators currently supported by YAP.
arith0_op defines constants and arity 0 arithmetic functions
constant operators specifies the available arithmetic "constants"
arith1_op defines single argument arithmetic functions
unary operators specifies the available unary arithmetic operators
arith2_op defines binary arithmetic functions
binary operators specifies the available binary arithmetic operators
Arithmetic expressions in YAP may use the following operators:
An approximation to the value of pi, that is, the ratio of a circle's circumference to its diameter
Euler's number, the base of the natural logarithms
The difference between the float 1.0
and the next largest floating point number
inf
Infinity according to the IEEE FloatingPoint standard Note that evaluating this term will generate a domain error in the iso
language modeNote also that YAP supports +inf
and inf
Notanumber according to the IEEE FloatingPoint standard Note that evaluating this term will generate a domain error in the iso
language mode
A "random" floating point number between 0 and 1
CPU time since YAP was invoked, in seconds
Heap (database) space used, in bytes
Amount of free stack space, that is, free space between global and local stacks
Complementary gaussian error function
An integer random number between 0 and X
In iso
language mode the argument must be a floating pointnumber, the result is an integer and it the float is equidistant it is rounded up, that is, to the least integer greater than X
If X evaluates to a float, the integer between the value of X and 0 closest to the value of X, else if X evaluates to an integer, the value of X
If X evaluates to an integer, the corresponding float, else the float itself
The fractional part of the floating point number X, or 0.0
if X is an integer In the iso
language mode, X must be an integer
The float giving the integer part of the floating point number X, or X if X is an integer In the iso
language mode, X must be an integer
The integer that is the smallest integral value not smaller than X
In iso
language mode the argument must be a floating pointnumber and the result is an integer
The integer that is the greatest integral value not greater than X
In iso
language mode the argument must be a floating pointnumber and the result is an integer
The nearest integral value to X If X is equidistant to two integers, it will be rounded to the closest even integral value
In iso
language mode the argument must be a floating pointnumber, the result is an integer and it the float is equidistant it is rounded up, that is, to the least integer greater than X
Return 1 if the X evaluates to a positive integer, 0 it if evaluates to 0, and 1 if it evaluates to a negative integer If X evaluates to a floatingpoint number return 1.0 for a positive X, 0.0 for 0.0, and 1.0 otherwise
The integral value between X and 0 closest to X
Convert the expression X to a rational number or integer The function returns the input on integers and rational numbers For floating point numbers, the returned rational number exactly represents the float As floats cannot exactly represent all decimal numbers the results may be surprising In the examples below, doubles can represent 0.25
and the result is as expected, in contrast to the result of rational(0.1)
The function rationalize/1
gives a more intuitive result
Convert the expression X to a rational number or integer The function is vvxu similar to rational/1, but the result is only accurate within the rounding error of floating point numbers, generally producing a much smaller denominator
Integer bitwise negation
The most significant bit of the nonnegative integer X
The least significant bit of the nonnegative integer X
The number of bits set to 1
in the binary representation of the nonnegative integer X
Evaluates to X for expression X Useful because character strings in Prolog are lists of character codes
is the same as
which would be evaluated as:
Addition, implemented between any two types of numbers
*_X_ Y [ISO]*
Addition, implemented between any two types of numbers
*_X_* Y [ISO]*
Product
Quotient.
*_X_// Y [ISO]*
Integer quotient
mod
but always has the same sign as X
( _X_  _X_ mod _Y_)// _Y_
*_X_ ^ Y [ISO]*
X raised to the power of Y, (from the CProlog syntax)
*_X_ ** Y [ISO]*
X raised to the power of Y (from ISO)
*_X_ /\ Y [ISO]*
Integer bitwise conjunction
*_X_ \/ Y [ISO]*
Integer bitwise disjunction
*_X_ # Y*
Integer bitwise exclusive disjunction
*_X_ >< Y*
Integer bitwise exclusive disjunction
*_X_ << Y*
Integer bitwise left logical shift of X by Y places
*_X_ > Y [ISO]*
Integer bitwise right logical shift of X by Y places
atan2/2
enum arith2_op 
Enumerations  
enum  arith2_op { op_plus , op_minus , op_times , op_fdiv , op_mod , op_rem , op_div , op_idiv , op_sll , op_slr , op_and , op_or , op_xor , op_atan2 , op_power , op_power2 , op_gcd , op_min , op_max , op_rdiv } 
binary operators More...  