Built-in functions: Math

@abs <number>

Return the absolute value of the number.

@abs -5

@echo $?

> 5

@sqrt <number>

Return the square root of the number (number >= 0).

@sqrt 9

@echo $?

> 3

@pow <base>, <exponent>

Return base raised to the power exponent.

@pow 2, 3

@echo $?

> 8

@exp <number>

Return e (Euler’s number) raised to the power number.

@exp 1

@echo $?

> 2.718281828459

@log <number>

Return the natural logarithm (base e) of number (number > 0).

@log 2.718281828459

@echo $?

> 1

@log10 <number>

Return the base-10 logarithm of number (number > 0).

@log10 100

@echo $?

> 2

@sin <radian>

Return the sine of an angle in radians.

@sin 1.5708

@echo $?

> 1

@cos <radian>

Return the cosine of an angle in radians.

@cos 0

@echo $?

> 1

@tan <radian>

Return the tangent of an angle in radians.

@tan 0.7854

@echo $?

> 1

@asin <value>

Return the arcsine (inverse sine) of value in [-1,1], result in radians.

@asin 1

@echo $?

> 1.5708

@acos <value>

Return the arccosine (inverse cosine) of value in [-1,1], result in radians.

@acos 1

@echo $?

> 0

@atan <number>

Return the arctangent (inverse tangent) of the number, result in radians.

@atan 1

@echo $?

> 0.7854

@round <number>

Round the number to the nearest integer.

@round 3.6

@echo $?

> 4

@floor <number>

Return the largest integer less than or equal to the number.

@floor 3.6

@echo $?

> 3

@ceil <number>

Return the smallest integer greater than or equal to the number.

@ceil 3.1

@echo $?

> 4

@trunc <number>

Return the integer part of the number by truncation.

@trunc 3.9

@echo $?

> 3

@rand_int <min>, <max>

Return a random integer between min and max (inclusive).

@rand_int 1, 10

@echo $?

> 7

@rand_float <min>, <max>

Return a random floating-point number between min (inclusive) and max (exclusive).

@rand_float 0.0, 1.0

@echo $?

> 0.345678