Return to index

math functions

positive_number = abs(number)

top

Calculate absolute value of number.

Example:

# Example for abs
println abs(-42)


float = acos(number)

top

Calculate arc cosine of number.

Example:

# Example for acos
println acos(0.5)


float = acosh(number)

top

Calculate hyberbolic arc cosine of number.

Example:

# Example for acosh
println acosh(2.0)


float = asin(number)

top

Calculate arc sine of number.

Example:

# Example for asin
println asin(42)


float = asinh(number)

top

Calculate hyberbolic arc sine of number.

Example:

# Example for asinh
println asinh(1.0)


float = atan(number)

top

Calculate arc tangent of number.

Example:

# Example for atan
println atan(42)


float = atanh(number)

top

Calculate hyberbolic arc tangent of number.

Example:

# Example for atanh
println atanh(42)


float = cos(number)

top

Calculate cosine of number.

Example:

# Example for cos
println cos(0.0)


float = cosh(number)

top

Calculate hyberbolic cosine of number.

Example:

# Example for cosh
println cosh(42)


float = deg2rad(number)

top

Convert degrees to radians.

Example:

# Example for deg2rad
println deg2rad(3.14)


float = e()

top

Returns the value of e.

Example:

# Example for e
println e()


float = floor(float)

top

Round float down to nearest integer.

Example:

# Example for floor
println floor(3.14)


string = ibase(n,int)

top

Returns a string holding a conversion of int to base n

Example:

# Example for ibase
println ibase(3.14, 3.14)


float = ln(number)

top

Calculate natural logarithm of number.

Example:

# Example for ln
println ln(3.14)


float = ln10()

top

Returns the value of ln10.

Example:

# Example for ln10
println ln10()


float = ln2()

top

Returns the value of ln2.

Example:

# Example for ln2
println ln2()


float = log10(number)

top

Calculate logarithm (base 10) of number.

Example:

# Example for log10
println log10(3.14)


float = log2(number)

top

Calculate logarithm (base 2) of number.

Example:

# Example for log2
println log2(3.14)


float = logn(number,base)

top

Calculate logarithm (base base) of number. FP results may be fuzzy. logn(0,x) is reported as 0f.

Example:

# Example for logn
println logn(3.14, 3.14)


string = numcomma(number[,precision])

top

Returns formatted number. This does not work with big ints or floats.

Example:

# Example for numcomma
println numcomma(3.14, 3.14)


float = phi()

top

Returns the value of phi.

Example:

# Example for phi
println phi()


float = pi()

top

Returns the value of pi.

Example:

# Example for pi
println pi()


float = pow(number,n)

top

Calculate number raised to the power n.

Example:

# Example for pow
println pow(2, 10)


bigfloat = prec(bigfloat,prec)

top

Returns a big float with a set precision (prec bits).

Example:

# Example for prec
println prec(as_bigf(3.14159), 2)


float = rad2deg(number)

top

Convert radians to degrees.

Example:

# Example for rad2deg
println rad2deg(3.14)


int = rand(positive_max_int)

top

Generate a random integer between 1 and positive_max_int inclusive.

Example:

# Example for rand
println rand(42)


float = randf(?number)

top

Generate a random float. With no argument, returns a float between 0 and 1. With a number argument, returns a float between 0 and that value.

Example:

# Example for randf
seed(12345)
println randf(100)
println randf()


float = round(float)

top

Round float to nearest integer.

Example:

# Example for round
println round(3.14)


seed(number)

top

Set the random seed. number of -1 sets the seed using current nano-second time.

Example:

# Example for seed
seed(12345)
println randf(100)


float = sin(number)

top

Calculate sine of number.

Example:

# Example for sin
println sin(1.0)


float = sinh(number)

top

Calculate hyberbolic sine of number.

Example:

# Example for sinh
println sinh(42)


float = tan(number)

top

Calculate tangent of number.

Example:

# Example for tan
println tan(1.0)


float = tanh(number)

top

Calculate hyberbolic tangent of number.

Example:

# Example for tanh
println tanh(1.0)


int = ubin8(unsigned_binary_string)

top

unsigned binary to decimal. (8-bit)

Example:

# Example for ubin8
println ubin8("10101010")


int = uhex32(unsigned_hex_string)

top

unsigned hexadecimal to decimal. (16-bit)

Example:

# Example for uhex32
println uhex32("FF")