# Math

The system supports the usual basic arithmetic operators:

   x + y   x - y   -x   x * y   x / y   x ^ y

## Functions​

abs(Number x)->Number y

Absolute value of x

abs(Real x)->Real y

Absolute value of x

abs(Integer x)->Integer y

Absolute value of x

acos(Real x)->Real

Inverse cosine radians of x

asin(Real x)->Real

Inverse sine radians of x

atan(Real x)->Real

Inverse tangent radians of x

atan2(Real y,Real x)->Real

The angle in radians between the positive x-axis of a plane and the point given by the coordinates (x, y) on it

ceiling(Number x)->Integer y

The closest integer y >= x

cos(Real x)->Real

Cosine of x radians

div(Number x,Number y)->Number z

Divide number x with y, x / y

divide(Integer x,Integer y)->(Integer q,Integer r)

Quotient q and remainder r when dividing x with y

even(Number i)->Boolean

True if i is even integer

exp(Real x)->Real

Natural exponent e^x

floor(Number x)->Integer y

The closest integer y <= x

frand(Real high)->Real

Real random number in interval [0,high)

frand(Real low,Real high)->Real

Real random number in interval [low,high)

integer(Number n)->Integer i

Truncate real number n to integer

isinteger(Number x)->Boolean

Is x an integer?

ln(Real x)->Real

Natural logarithm of x

log10(Real x)->Real

The base 10 logarithm of x

max(Object x,Object y)->Object

The largest of objects x and y

min(Object x,Object y)->Object

The smallest of objects x and y

minus(Number x,Number y)->Number z

Subtract y from x, x-y

mod(Number x,Number y)->Number

Remainder when dividing x with y

not(Vector of Integer v)->Vector of Integer

not(Integer i)->Integer

number(Object x)->Number

Cast x to number

odd(Number i)->Boolean

True if i is odd integer

pi()->Real

The constant PI

plus(Number x,Number y)->Number r

Add x and y, x + y

power(Real base,Real power)->Real

base^power and its inverse

rand(Integer low,Integer high)->Integer

Integer random number in interval [low,high)

rand(Integer high)->Integer

Integer random number in interval [0,high)

rand_seed(Integer x)->Integer

New random seed

range(Integer u)->Bag of Integer

Construct bag of integers between one and u

range(Integer l,Integer u)->Bag of Integer

Construct bag of integers between l and u

range(Integer l,Integer u,Integer s)->Bag of Integer

Constuct bag of integers between l and u with step s

real(Number n)->Real

Make a real number of n

round(Number x)->Integer

Round x to nearest integer

roundto(Object o,Integer digits)->Literal

Round numeric values in o to digits significant decimals

sign(Number x)->Integer

The signum of x

sin(Real x)->Real

Sine of x radians

sqrt(Real x)->Real r

The positive square root of x

tan(Real x)->Real

Tangent of x radians

times(Number x,Number y)->Number z

Multiply x with y, x * y

uminus(Number x)->Number

Unary minus -x

vrange(Integer u)->Vector of Integer

Construct vector of integers between one and u

vrange(Integer l,Integer u,Integer s)->Vector of Integer

Constuct vector of integers between l and u with step s

vrange(Integer l,Integer u)->Vector of Integer

Construct vector of integers between l and u