Next: Binary Logic, Previous: Unary Plus, Up: Operators [Contents][Index]
Binary arithmetical operators are defined for scalar
s (both real
and complex), array
s (real and complex), and range
s (if
the range elements are numerical), and addition is also defined for
string
s. The operator goes between the two operands. The data
type of the result is equal to the highest data type present among the
operands, except where noted. There is no implicit conjugation when
multiplying or dividing complex numbers.
The available binary operators are:
x + y
adds the values of x
and y
(if they are
numerical) or concatenates the values (if they are STRI
G
s). For
instance, 'alpha' + 'bet'
equals 'alphabet'
.
x - y
subtracts the value of y
from the value of
x
.
x * y
multiplies the values of x
and y
.
x # y
multiplies matrix x
and matrix y
. See
mproduct.
x / y
divides the value of x
by the value of y
. If
x
and y
are both integer, then only the integer part
of the division is returned.
x ^ y
raises x
to the power y
. The result is
always of a floating-point data type.
x MOD y
and x % y
return x
modulus y
, i.e.,
the nonnegative remainder of the division of x
by y
.
x SMOD y
return the signed remainder of the division of
x
by y
, i.e., the smallest (in absolute terms)
remainder. If x = 3*y - 1
then x MOD y
yields y -
1
but x SMOD y
yields -1
.
Next: Binary Logic, Previous: Unary Plus, Up: Operators [Contents][Index]