# Mathematical functions

Mathematical functions are built-in functions and they can be called from scripts.
Note: Functions can be written in Legacy Script Language or in ECMAScript. For details, see Scripts within tests and stubs. All the examples given in the following table are in Legacy, unless otherwise specified.
Function Usage
Absolute value

The Absolute Value function returns the absolute value of the expression.

``abs(expr)``

The Add function returns the sum of the expressions.

``add(expr,expr, ...)``
Divide

The Divide function returns the quotient of the expressions (the first divided by the second.

``divide(expr,expr)``
Floor

The Floor function returns the highest integer that is less than the specified expression.

``floor(expr)``
Modulo

The Modulo function returns the remainder of dividing the first expression by the second.

``mod(expr,expr)``
Multiply

The Multiply function returns the product of two expressions.

``multiply(expr,expr)``
Round

The Round function returns the value of the expression, rounded to the (optional) number of decimal places or to the nearest whole number.

``round( expr[, decimal places] )``

Example:

``round(add(-0.22,300),2)``
Returns: 299.78
``round(add(-0.22,300))``
Returns: 300
Subtract

The Subtract function returns the difference of two expressions (the second subtracted from the first).

``subtract(expr,expr)``
Feedback