Functions for performing various mathematical operations such as rounding, exponentiation, squaring, etc.

- General Math
- Abs: Returns the absolute value of a number.
- Ceil: Returns a number rounded up to the nearest integer.
- Exp: Returns e raised to the
*N*th power. - Floor: Returns a number rounded down to the nearest integer.
- Log: Returns the logarithm (base 10) of a number.
- Ln: Returns the natural logarithm (base e) of a number.
- Max: Returns the highest value of one or more numbers.
- Min: Returns the lowest value of one or more numbers.
- Mod: Returns the remainder of a division.
- Round: Returns a number rounded to
*N*decimal places. - Sqrt: Returns the square root of a number.

- Trigonometry
- Sin: Returns the trigonometric sine of a number.
- Cos: Returns the trigonometric cosine of a number.
- Tan: Returns the trigonometric tangent of a number.
- ASin: Returns the arcsine (the number whose sine is the specified number) in radians.
- ACos: Returns the arccosine (the number whose cosine is the specified number) in radians.
- ATan: Returns the arctangent (the number whose tangent is the specified number) in radians.

- Error-handling

Returns the absolute value of *Number*.

`Value := Abs(Number)`

The return value is the same type as *Number* (integer or floating point).

MsgBox Abs(-1.2); Returns 1.2

Returns *Number* rounded up to the nearest integer (without any .00 suffix).

`Value := Ceil(Number)`

MsgBox Ceil(1.2); Returns 2MsgBox Ceil(-1.2); Returns -1

Returns e (which is approximately 2.71828182845905) raised to the *N*th power.

`Value := Exp(N)`

*N* may be negative and may contain a decimal point. To raise numbers other than e to a power, use the ** operator.

MsgBox Exp(1.2); Returns 3.320117

Returns *Number* rounded down to the nearest integer (without any .00 suffix).

`Value := Floor(Number)`

MsgBox Floor(1.2); Returns 1MsgBox Floor(-1.2); Returns -2

Returns the logarithm (base 10) of *Number*.

`Value := Log(Number)`

The result is a floating-point number. If *Number* is negative, an exception is thrown.

MsgBox Log(1.2); Returns 0.079181

Returns the natural logarithm (base e) of *Number*.

`Value := Ln(Number)`

The result is a floating-point number. If *Number* is negative, an exception is thrown.

MsgBox Ln(1.2); Returns 0.182322

Returns the highest value of one or more numbers.

Value := Max(Number1 , Number2, ...)

MsgBox Max(2.11, -2, 0); Returns 2.11

You can also specify a variadic parameter to compare multiple values within an array. For example:

array := [1, 2, 3, 4] MsgBox Max(array*); Returns 4

Returns the lowest value of one or more numbers.

Value := Min(Number1 , Number2, ...)

MsgBox Min(2.11, -2, 0); Returns -2

You can also specify a variadic parameter to compare multiple values within an array. For example:

array := [1, 2, 3, 4] MsgBox Min(array*); Returns 1

Modulo. Returns the remainder when *Dividend* is divided by *Divisor*.

`Value := Mod(Dividend, Divisor)`

The sign of the result is always the same as the sign of the first parameter. If either input is a floating point number, the result is also a floating point number. If the second parameter is zero, an exception is thrown.

MsgBox Mod(7.5, 2); Returns 1.5 (2 x 3 + 1.5)

Returns *Number* rounded to *N* decimal places.

Value := Round(Number , N)

If *N* is omitted or 0, *Number* is rounded to the nearest integer:

MsgBox Round(3.14); Returns 3

If *N* is positive number, *Number* is rounded to *N* decimal places:

MsgBox Round(3.14, 1); Returns 3.1

If *N* is negative, *Number* is rounded by *N* digits to the left of the decimal point:

MsgBox Round(345, -1); Returns 350MsgBox Round(345, -2); Returns 300

The result is an integer if *N* is omitted or less than 1. Otherwise, the result is a numeric string with exactly *N* decimal places. If a pure number is needed, simply perform another math operation on Round's return value; for example: `Round(3.333, 1)+0`

.

Returns the square root of *Number*.

`Value := Sqrt(Number)`

The result is a floating-point number. If *Number* is negative, an exception is thrown.

MsgBox Sqrt(16); Returns 4

**Note**: To convert a radians value to degrees, multiply it by 180/pi (approximately 57.29578). To convert a degrees value to radians, multiply it by pi/180 (approximately 0.01745329252). The value of pi (approximately 3.141592653589793) is 4 times the arctangent of 1.

Returns the trigonometric sine of *Number*.

`Value := Sin(Number)`

*Number* must be expressed in radians.

MsgBox Sin(1.2); Returns 0.932039

Returns the trigonometric cosine of *Number*.

`Value := Cos(Number)`

*Number* must be expressed in radians.

MsgBox Cos(1.2); Returns 0.362358

Returns the trigonometric tangent of *Number*.

`Value := Tan(Number)`

*Number* must be expressed in radians.

MsgBox Tan(1.2); Returns 2.572152

Returns the arcsine (the number whose sine is *Number*) in radians.

`Value := ASin(Number)`

If *Number* is less than -1 or greater than 1, an exception is thrown.

MsgBox ASin(0.2); Returns 0.201358

Returns the arccosine (the number whose cosine is *Number*) in radians.

`Value := ACos(Number)`

If *Number* is less than -1 or greater than 1, an exception is thrown.

MsgBox ACos(0.2); Returns 1.369438

Returns the arctangent (the number whose tangent is *Number*) in radians.

`Value := ATan(Number)`

MsgBox ATan(1.2); Returns 0.876058

These functions throw an exception if any incoming parameters are non-numeric or an invalid operation (such as divide by zero) is attempted.