6. ARITHMETIC COMMANDS & OPERATORS
6.1. Basic Operators
Basic
operators
The following operators work on both integers and real numbers.
x := y
Assignment (the value of y is assigned to x)
x + y
Addition
x - y
Subtraction
x * y
Multiplication
x / y
Division
-x
Negative value
abs(x)
Absolute value
6.2. Integer Operators & Commands
The following commands and operators can only be performed on integer variables and values.
inc(x)
Increment an expression by 1 (x + 1)
dec(x)
Decrement an expression by 1 (x – 1)
x mod y
Modulo; returns
the remainder of a division
e.g. 13 mod 8 returns the value 5
6.3. Real Number Commands
The following commands can only be performed on real numbers.
exp(x)
Exponential function (returns the value of e^x)
log(x)
Logarithmic
function
pow(x,y)
Power (returns the value of x^y)
sqrt(x)
Square root
Do'stlaringiz bilan baham: