# Mathematical Functions

Help Contents

## Introduction

Fernhill SCADA supports these mathematical functions defined by the IEC 61131-3 standard:

FunctionParameter TypeParametersDescription
ABS ANY_MAGNITUDE 1 Return the absolute value
SQRT ANY_REAL 1 Return the square root
LN ANY_REAL 1 Return the natural logarithm
LOGANY_REAL1Return logarithm base 10
EXPANY_REAL1Return natural exponent
SIN ANY_REAL 1 Return the sine of the input. The input is in radians
COS ANY_REAL 1 Return the cosine of the input. The input is in radians
TAN ANY_REAL 1 Return the tangent of the input. The input is in radians
ASIN ANY_REAL 1 Return the principle arc sine of the input. The output is in radians
ACOS ANY_REAL 1 Return the principle cosine of the input. The output is in radians
ATAN ANY_REAL 1 Return the principle tangent of the input. The output is in radians
ATAN2 ANY_REAL, ANY_REAL 2 Return the principle tangent of the input. The output is in radians.

In addition Fernhill SCADA supports these functions as an extension to the IEC 61131-3 standard:

FunctionParameter TypeParametersDescription
CEILINGANY_NUM1Return the next highest whole number.
FLOORANY_NUM1Return the next lowest whole number.
ROUNDANY_MAGNITUDE, ANY_INT2Returns a value rounded to n decimal digits.
Half way cases are rounded away from zero.
ROUNDSDANY_MAGNITUDE, ANY_INT2Returns a value rounded to n significant digits.
Half way cases are rounded away from zero.
SIGNANY_MAGNITUDE1Return the sign of the value as +1 for positive, -1 for negative, or 0 for zero.

Mathematical functions ABS, and SIGN also work with the TIME data type. For example:

ABS( T#-5s ) returns T#5s.

## Standards Compliance

IEC 61131-3 Second Edition: Table 23.

IEC 61131-3 Third Edition: Table 28.

## Further Information

Generic Data Types

To learn about generic data types such as ANY_INT, ANY_NUM, ANY_MAGNITUDE.

Time Functions

To learn about arithmetic operations on date and time types.

Common Elements

To learn about other language Common Elements.

Glossary

For the meaning of terms used in Fernhill SCADA.