# Mathematical routine

The DataOperation routine contains functions which perform mathematical operations.

You can access these functions by double-clicking the Mathematical node under the system routines folder in the Repository tree view.

Functions of the DataOperation routine

Function

Description

Syntax

ABS

Returns the absolute (positive) numeric value of an expression that is of the double type. This function returns a value of the double type.

Example:
• Mathematical.ABS(-3.14)
• Output: 3.14

Mathematical.ABS(double a)

ACOS

Calculates the trigonometric arc-cosine of an expression that is of the double type. This function returns a value of the double type.

Example:
• Mathematical.ACOS(0.5)
• Output: 1.0471975511965979

Mathematical.ACOS(double a)

ASIN

Calculates the trigonometric arc-sine of an expression that is of the double type. This function returns a value of the double type.

Example:
• Mathematical.ASIN(0.5)
• Output: 0.5235987755982989

Mathematical.ASIN(double a)

ATAN

Calculates the trigonometric arctangent of an expression that is of the double type. This function returns a value of the double type.

Example:
• Mathematical.ATAN(0.5)
• Output: 0.4636476090008061

Mathematical.ATAN(double a)

BITAND

Performs a bitwise AND operation to two expressions that are of the int type. This function returns a value of the int type.

Example:
• Mathematical.BITAND(3,6)
• Output: 2

Mathematical.BITAND(int a, int b)

BITNOT

Performs a bitwise NOT operation to an expression that is of the int type. This function returns a value of the int type.

Example:
• Mathematical.BITNOT(3)
• Output: -4

Mathematical.BITNOT(int a)

BITOR

Performs a bitwise OR operation to two expressions that are of the int type. This function returns a value of the int type.

Example:
• Mathematical.BITOR(3,6)
• Output: 7

Mathematical.BITOR(int a, int b)

BITXOR

Performs a bitwise XOR operation to two expressions that are of the int type. This function returns a value of the int type.

Example:
• Mathematical.BITXOR(3,6)
• Output: 5

Mathematical.BITXOR(int a, int b)

COS

Calculates the trigonometric cosine of an expression that is of the double type. This function returns a value of the double type.

Example:
• Mathematical.COS(3.14)
• Output: -0.9999987317275395

Mathematical.COS(double a)

COSH

Calculates the hyperbolic cosine of an expression that is of the double type. This function returns a value of the double type.

Example:
• Mathematical.COSH(3.14)
• Output: 11.573574828312076

Mathematical.COSH(double a)

DIV

Calculates the whole part of the real division that are of two expressions that are of the double type. This function returns a value of the int type.

Example:
• Mathematical.DIV(9.6,6.4)
• Output: 1

Mathematical.DIV(double a, double b)

EXP

Calculates the result of base e raised to the power designated by an expression that is of the double type. This function returns a value of the double type.

Example:
• Mathematical.EXP(2.5)
• Output: 12.182493960703473

Mathematical.EXP(double a)

INT

Calculates the integer numeric value of an expression that is of the string type. This function returns a value of the int type.

Example:
• Mathematical.INT("100")
• Output: 100

Mathematical.INT(string a)

FFIX

Rounds the value of an expression that is of the double type to a string with a fixed precision. FFIX is provided for compatibility with existing software. This function returns a value of the string type.

Example:
• Mathematical.FFIX(3.1415926.2)
• Output: 3.14

Mathematical.FFIX(double a, int precision)

FFLT

Rounds the value of an expression that is of the double type to a string with a precision of 14. This function returns a value of the string type.

Example:
• Mathematical.FFLT(3.1415926535897932)
• Output: 3.14159265358979

Mathematical.FFLT(double a)

LN

Calculates the natural logarithm of an expression that is of the double type. This function returns a value of the double type.

Example:
• Mathematical.LN(2.71828)
• Output: 0.999999327347282

Mathematical.LN(double a)

MOD

Calculates the modulo (the remainder) of two expressions that is of the double type. This function returns a value of the String type.

Example:
• Mathematical.MOD(7,3)
• Output: 1.0

Mathematical.MOD(double a, double b)

NEG

Returns the arithmetic additive inverse of the value of an expression that is of the double type. This function returns a value of the double type.

Example:
• Mathematical.NEG(3.14)
• Output: -3.14

Mathematical.NEG(double a)

NUM

Returns true (1) if the value of an expression is a numeric data type; otherwise, returns false (0).

Example:
• Mathematical.NUM("3")
• Output: 1

Mathematical.NUM(double a)

REAL

Converts a numeric expression into a real number without loss of accuracy. This function returns a value of the double type.

Example:
• Mathematical.REAL("3.14")
• Output: 3.14

Mathematical.REAL(double a)

RND

Generates a random number between zero and the value of an expression that is of the double type. This function returns a value of the double type.

Example:
• Mathematical.RND(1.5)
• Output: 0.6509250767781953

Adds two string numbers and returns the result as a string number.

Example:
• Output: 10.0

SCMP

Compares two string numbers and returns:

• 1 if a is larger than b;
• 0 if a is equal to b;
• -1 if a is less than b.
Example:
• Mathematical.SCMP("3","7")
• Output: -1

Mathematical.SCMP(String a,String b)

SDIV

Returns the quotient of the whole division of two integers. This function returns a value of the int type.

Example:
• Mathematical.SDIV(7,3)
• Output: 2

Mathematical.SDIV(int a, int b)

SIN

Returns the trigonometric sine of an expression. This function returns a value of the double type.

Example:
• Mathematical.SIN(3.14/4)
• Output: 0.706825181105366

Mathematical.SIN(double a)

SINH

Returns the hyperbolic sine of an expression. This function returns a value of the double type.

Example:
• Mathematical.SIN(3.14/4)
• Output: 0.8681436194737884

Mathematical.SINH(double a)

SMUL

Multiplies two string numbers. This function returns a value of the double type.

Example:
• Mathematical.SMUL("4","5")
• Output: 20.0

Mathematical.SMUL(String a,String b)

SQRT

Calculates the square root of a number. This function returns a value of the double type.

Example:
• Mathematical.SQRT(1.69)
• Output: 1.3

Mathematical.SQRT(double a)

SSUB

Subtracts one string number from another and returns the result as a string number.

Example:
• Mathematical.SSUB("5","3")
• Output: 2.0

Mathematical.SSUB(String a,String b)

TAN

Returns the trigonometric tangent of an expression. This function returns a value of the double type.

Example:
• Mathematical.TAN(3.14/4)
• Output: 0.9992039901050427

Mathematical.TAN(double a)

TANH

Returns the hyperbolic tangent of an expression. This function returns a value of the double type.

Example:
• Mathematical.TANH(3.14/4)
• Output: 0.6555672165322445

Mathematical.TANH(double a)