next up previous index
Next: Strings and Atoms Up: The Built-in Predicates Previous: All Solutions Built-ins

Arithmetic Built-ins

The following arithmetic predicates exist. The implementation of arithmetic is described in more detail in chapter gif on page gif.

ECLiPSe Arithmetic built-in.

(+Number1, +Number2, ?Result)

Evaluates the product Number1 Number2 and unifies the resulting value with Result.  
+(+Number1, +Number2, ?Result)

Evaluates the sum Number1 + Number2 and unifies the resulting value with Result.  
-(+Number, ?Result)

Unifies the negative of Number with Result.  
-(+Number1, +Number2, ?Result)

Evaluates the difference Number1 - Number2 and unifies the resulting value with Result.  
<<(+Number1, +Number2, ?Result)

Shifts Number1 left arithmetically by Number2 bits and unifies the resulting value with Result.  
>>(+Number1, +Number2, ?Result)

Shifts Number1 right arithmetically by Number2 bits and unifies the resulting value with Result.  
(+Number, ?Result)

Evaluates the bitwise complement of Number and unifies the resulting value with Result.  
/(+Number1, +Number2, ?Result)

Evaluates the bitwise disjunction Number1 / Number2 and unifies the resulting value with Result.  
+(+Number, ?Result)

Checks if Number is a number and unifies it with Result.  
+Expr1 < +Expr2

Succeed if the value of Expr1 is less than the value of Expr2.  
+Expr1 =< +Expr2

Succeed if the value of Expr1 is less than or equal to the value of Expr2.  
+Expr1 +Expr2

Succeed if the value of Expr1 is not equal to the value of Expr2.  
+Expr1 > +Expr2

Succeed if the value of Expr1 is greater than the value of Expr2.  
+Expr1 >= +Expr2

Succeed if the value of Expr1 is greater than or equal to the value of Expr2.  
+Expr1 =:= +Expr2

Succeed if the value of Expr1 is equal to the value of Expr2.  
/(+Number1, +Number2, ?Result)

Evaluates the bitwise conjunction Number1 / Number2 and unifies the resulting value with Result.  
/(+Number1, +Number2, ?Result)

Evaluates the quotient Number1 / Number2 and unifies the resulting value with Result.  
//(+Number1, +Number2, ?Result)

Evaluates the integer quotient Number1 // Number2 and unifies the resulting value with Result.  
?Result is +Expression

Evaluates the arithmetic expression Expression and unifies the resulting value with Result.  
abs(+Number, ?Result)

Unifies the absolute value of Number with Result.  
acos(+Number, ?Result)

Evaluates the trigonometric function acos(Number) and unifies the resulting value with Result.  
asin(+Number, ?Result)

Evaluates the trigonometric function asin(Number) and unifies the resulting value with Result.  
atan(+Number, ?Result)

Evaluates the trigonometric function atan(Number) and unifies the resulting value with Result.  
between(+From, +To, +Step, ?Result)

Generate integer values between From and To with Step increment.  
cos(+Number, ?Result)

Evaluates the trigonometric function cos(Number) and unifies the resulting value with Result.  
denominator(+Number, ?Result)

Extracts the denominator of the rational Number and unifies the resulting integer with Result.  
exp(+Number, ?Result)

Evaluates the exponential function exp(Number) ("e to the power of Number") and unifies the resulting value with Result.  
fix(+Number, ?Result)

Unifies the integer part of Number with Result (Truncation towards zero).  
float(+Number, ?Result)

Converts the integer Number to real and unifies the resulting value with Result.  
floor(+Number, ?Result)

Unifies Result with the greatest integral value that is less or equal than Number and of the same numeric type as Number.  
ln(+Number, ?Result)

Evaluates the natural logarithm ln(Number) and unifies the resulting value with Result.  
max(+Number1, +Number2, ?Maximum)

Unifies the maximum of Number1 and Number2 with Maximum.  
min(+Number1, +Number2, ?Minimum)

Unifies the minimum of Number1 and Number2 with Minimum.  
mod(+Number1, +Number2, ?Result)

Evaluates the modulus Number1 mod Number2 and unifies the resulting value with Result.  
numerator(+Number, ?Result)

Extracts the numerator of the rational Number and unifies the resulting integer with Result.  
plus(?Add1, ?Add2, ?Sum)

Succeeds if Sum is the sum of integer arguments Add1 and Add2.  
rational(+Number, ?Result)

Converts Number into a rational number and unifies it with Result.  
round(+Number, ?Result)

Rounds Number to the nearest integral value of the same type and unifies the resulting real value with Result.  
sgn(+Number, ?Result)

Unifies Result with the sign of Number which is either --1, 0 or 1.  
sin(+Number, ?Result)

Evaluates the trigonometric function sin(Number) and unifies the resulting value with Result.  
sqrt(+Number, ?Result)

Evaluates the square root sqrt(Number) and unifies the resulting value with Result.  
tan(+Number, ?Result)

Evaluates the trigonometric function tan(Number) and unifies the resulting value with Result.  
times(?Factor1, ?Factor2, ?Product)

Succeeds if Product is the result of multiplying integer arguments Factor1 and Factor2.  
xor(+Number1, +Number2, ?Result)

Evaluates the bitwise exclusive disjunction Number1 xor Number2 and unifies the resulting value with Result.  
^(+Number1, +Number2, ?Result)

Evaluates the expression Number1 "to the power of" Number2 and unifies the resulting value with Result.  



next up previous index
Next: Strings and Atoms Up: The Built-in Predicates Previous: All Solutions Built-ins



Micha Meier
Mon Mar 4 12:11:45 MET 1996