Previous Top Index Next

Math Functions

ABS(number)

return absolute value of number
abs(-2.3) /* 2.3 */

FORMAT(number[,[before][,[after][,[expp][,expt]]]])

rounds and formats number with before integer digits and after decimal places. expp accepts the values 1 or 2 (WARNING Totally differen't from the Ansi-REXX spec) where 1 means to use the "G" (General) format of C, and 2 the "E" exponential format of C. Where the place of the totalwidth specifier in C is replaced by before+after+1. ( expt is ignored! )
format(2.66) /* 3 */
format(2.66,1,1) /* 2.7 */
format(26.6,1,1,1) /* 3.E+01 */
format(26.6,1,1,2) /* 2.7E+01 */

IAND(n,m)

return bitwise AND of the integers n and m
iand(2,3) /* 2 */

INOT(n)

return bitwise complement of integers n
inot(2) /* -3 */

IOR(n,m)

return bitwise OR of the integers n and m
ior(2,3) /* 3 */

IXOR(n,m)

return bitwise XOR of the integers n and m
ixor(2,3) /* 1 */

MAX(number[,number]..])

returns the largest of given numbers.
max(2,3,1,5) /* 5 */

MIN(number[,number]..])

returns the smallest of given numbers.
min(2,3,1,5) /* 1 */

RANDOM([min][,[max][,seed]])

returns a pseudorandom nonnegative whole number in the range min to max inclusive.

SIGN(number)

return the sign of number ("-1","0" or "1").
sign(-5.2) /* -1 */
sign( 0.0) /* 0 */
sign( 5.2) /* 1 */

TRUNC(number[,n])

returns the integer part of number, and n decimal places. The default n is zero.
trunc(2.6) /* 2 */

The following are common math functions that return one real number.

ACOS( num ) Arc-cosine
ASIN( num ) Arc-sine
ATAN( num ) Arc-tangent
COS( num ) Cosine
COSH( num ) Hyperbolic cosine
EXP( num ) Exponiate
LOG( num ) Natural logarithm
LOG10( num ) Logarithm of base 10
POW10( num ) Power with base 10
SIN( num ) Sine function
SINH( num ) Hyperbolic sine
SQRT( num ) Square root
TAN( num ) Tangent
TANH( num ) Hyperbolic tangent
POW( a,b ) Raises a to power b

Previous Top Index Next