math

abs, acos, asin, atan, atan2, cbrt, ceil, cos, cosh, cube, exp, factorial, floor, log, log10, log2, logb, nroot, pow, random, round, sign, sin, sinh, sqr, sqrt, tan, tanh, trunc


<abs>

Syntax

+y = abs(+x)

Description

Returns the absolute value of +x.

Examples

abs(3.7) == 3.7
abs(-3.7) == 3.7
abs(-infinity) == +infinity

See Also

sign


<acos>

Syntax

+y = acos(+x)

Description

Returns the arccosine of +x (which should be in the range -1 to 1 or the result will be undefined). The returned value is in the range 0 to PI.

Inverse: cos().

Examples

acos(0.0) == PI / 2
acos(0.73168886887382) == 0.75
acos(cos(0.6)) == 0.6

See Also

asin, atan, cos


<asin>

Syntax

+y = asin(+x)

Description

Returns the arcsine of +x (which should be in the range -1 to 1 or the result will be undefined). The returned value is in the range -PI / 2 to PI / 2.

Inverse: sin().

Examples

asin(0.0) == 0.0
asin(0.69613523862736) == 0.77
asin(sin(0.5)) == 0.5

See Also

acos, atan, sin


<atan>

Syntax

+y = atan(+x)

Description

Returns the arctangent of +x. The returned value is in the range -PI / 2 to PI / 2.

Inverse: tan().

Examples

atan(0.0) == 0.0
atan(0.93159645994407) == 0.75
atan(tan(0.5)) == 0.5

See Also

acos, asin, atan2, tan


<atan2>

Syntax

+z = atan2(+y, +x)

Description

Returns the arctangent of +y/+x with proper handling of quadrants. The returned value is in the range -PI to PI.

Examples

atan2(0.0, 1.0) == 0.0
atan2(1.0, 0.0) == PI / 2
atan2(sin(0.5), cos(0.5)) == 0.5

See Also

atan


cbrt

Syntax

+y = cbrt(+x)

Description

Returns the cube root of +x.

Inverse: cube(+y).

Examples

cbrt(0.0) == 0.0
cbrt(0.421875) == 0.75
cbrt(cube(-0.7)) == -0.7

See Also

sqr


<ceil>

Syntax

+y = ceil(+x)

Description

Returns the ceiling of value +x. Ceil() rounds both positive and negative values upwards.

Examples

ceil(0.0) == 0.0
ceil(-0.99999) == 0.0
ceil(1000.00001) == 1001.0

See Also

floor, round, trunc


<cos>

Syntax

+y = cos(+x)

Description

Returns the cosine of +x. The returned value is in the range -1 to 1.

Inverse: acos().

Examples

cos(0.0) == 1.0
cos(0.72273424781342) == 0.75
cos(acos(0.5)) == 0.5

See Also

acos, sin, tan


<cosh>

Syntax

+y = cosh(+x)

Description

Returns the hyperbolic cosine of +x.

Examples

cosh(0.0) == 1.0
cosh(0.9624236501192069) == 1.5

See Also

sinh, tanh


cube

Syntax

+y = cube(+x)

Description

Returns the cube of +x.

Inverse: cbrt(+y).

Examples

cube(0.0) == 0.0
cube(0.90856029641607) == 0.75
cube(cbrt(-0.7)) == -0.7

See Also

cbrt, sqr


<exp>

Syntax

+y = exp(+x)

Description

Returns the exponential of +x. I.e, the result is e to the power +x.

Inverse: log().

Examples

exp(0.0) == 1.0
exp(1.0) == 2.718281828459
exp(-0.28768207245178) == 0.75
exp(log(0.6)) == 0.6

See Also

log, log2, log10, pow


factorial

Syntax

+y = factorial(+x)

Description

Returns the factorial of value +x. +x should be an integer in the range of 1 to 170.

Examples

factorial(10) == 3628800

<floor>

Syntax

+y = floor(+x)

Description

Returns the floor of value +x. Floor() rounds both positive and negative values downwards.

Examples

floor(0.0) == 0.0
floor(-0.99999) == -1.0
floor(1000.00001) == 1000.0

See Also

ceil, round, trunc


<log>

Syntax

+y = log(+x)

Description

Returns the natural logarithm of +x (i.e. the logarithm with base e). +x should be positive or the result will be undefined.

Inverse: exp().

Examples

log(0.0) == -infinity
log(1.0) == 0.0
log(2.7182818284591) == 1.0
log(exp(0.6)) == 0.6

See Also

exp, log2, log10, logb, nroot, pow


<log10>

Syntax

+y = log10(+x)

Description

Returns the base-10 logarithm of +x. +x should be positive or the result will be undefined.

Inverse: pow(10, +y).

Examples

log10(0.0) == -infinity
log10(1.0) == 0.0
log10(10000.0) == 4.0
log10(pow(10, 0.6)) == 0.6

See Also

exp, log, log2, logb, nroot, pow


log2

Syntax

+y = log2(+x)

Description

Returns the base-2 logarithm of +x. +x should be positive or the result will be undefined.

Inverse: pow(2, +y).

Examples

log2(0.0) == -infinity
log2(1.0) == 0.0
log2(65536.0) == 16.0
log2(pow(2, 1.3)) == 1.3

See Also

exp, log, log10, logb, nroot, pow


logb

Syntax

+y = logb(+b, +x)

Description

Returns the logarithm of +x with base +b. +x should be positive or the result will be undefined. Equivalent to log(+x) / log(+b).

Inverses: +x = pow(+b, +y), +b = nroot(+y, +x).

Examples

logb(20, 1.0) == 0.0
logb(20, 8000) == 3

See Also

exp, log, log2, log10, nroot, pow


nroot

Syntax

+x = nroot(+y, +z)

Description

Returns the nth (+y) root of +z.

Inverse: +z = pow(+x, +y).

Examples

nroot(11, pow(17, 11)) == 17

See Also

exp, log, log2, logb, log10, pow


<pow>

Syntax

+z = pow(+x, +y)

Description

Returns +x raised to the power of +y.

Inverses: +y = log(+z) / log(+x) or logb(+x, +z), +x = pow(+z, 1.0 / +y) or nroot(+y, +z).

Examples

pow(0.0, 0.0) == 1.0
pow(10.0, 4.0) == 10000.0
pow(10.0, log10(0.8)) == 0.8
pow(pow(2.8, 9.8), 1.0 / 9.8) == 2.8

See Also

exp, log, log2, logb, log10, nroot


<random>

Syntax

+y = random(+x)

Description

Returns a pseudo-random number between 0 and +x.

Examples

random(100.0)

round

Syntax

+y = round(+x)

Description

Rounds the value of +x to the nearest integer. If the decimal part of +x is exactly 0.5, the rounding will be upwards (e.g. -3.5 rounds to 3.0).

Examples

round(1.23456) == 1
round(-1.6789) == -2
round(3.5) == 4.0
round(-3.5) == -3.0
round(1000.499999) == 1000.0

See Also

ceil, floor, trunc


sign

Syntax

+y = sign(+x)

Description

Returns -1 if +x is negative, +1 if +x is positive or 0 if +x is zero.

Examples

sign(0.0) == 0.0
sign(12.34) == 1
sign(-infinity) == -1

See Also

abs


<sin>

Syntax

+y = sin(+x)

Description

Returns the sine of +x. The returned value is in the range -1 to 1.

Inverse: asin().

Examples

sin(0.0) == 0.0
sin(0.84806207898148) == 0.75
sin(asin(0.5)) == 0.5

See Also

asin, cos, tan


<sinh>

Syntax

+y = sinh(+x)

Description

Returns the hyperbolic sine of +x.

Examples

sinh(0.0) == 0.0
sinh(0.61958958372348) == 0.66

See Also

cosh, tanh


sqr

Syntax

+y = sqr(+x)

Description

Returns the square of +x.

Inverse: sqrt(+y).

Examples

sqr(0.0) == 0.0
sqr(0.86602540378444) == 0.75
sqr(sqrt(0.75)) == 0.75

See Also

cube, sqrt


<sqrt>

Syntax

+y = sqrt(+x)

Description

Returns the square root of +x. +x should be positive or the result will be undefined.

Inverse: sqr(+y).

Examples

sqrt(0.0) == 0.0
sqrt(0.5625) == 0.75
sqrt(sqr(0.7)) == 0.7

See Also

sqr


<tan>

Syntax

+y = tan(+x)

Description

Returns the tangent of +x.

Inverse: atan(+y).

Examples

tan(0.0) == 0.0
tan(0.603982978253) == 0.69
tan(atan(0.3)) == 0.3

See Also

atan, cos, sin


<tanh>

Syntax

+y = tanh(+x)

Description

Returns the hyperbolic tangent of +x.

Examples

tanh(0.0) == 0.0
tanh(0.9729550745276566) == 0.75

See Also

cosh, sinh


trunc

Syntax

+y = trunc(+x, [+n = 0])

Description

Truncates the value of +x leaving up to +n decimal places intact. If +n is omitted, all decimals are truncated. Truncation rounds positive values downwards and negative values upwards.

Examples

trunc(1.23456) == 1
trunc(-1.23456) == -1
trunc(1.23456, 2) == 1.23
trunc(1.5, 10) == 1.5

See Also

ceil, floor, precision, round