143
ST Language Configuration Section 5-4
type variables A=3 and B= 2, if the operation (A/B)*2 is performed, the result
of A/B is 1 (1.5 with the value below the decimal discarded), so (A/B)*2 = 2.
5-4-5 Standard Functions
Numerical Functions
Function type Syntax
Numerical Functions Absolute values, trigonometric functions, etc.
Arithmetic Functions Exponential (EXPT)
Data Type Conversion Functions Source_data_type_TO_New_data_type (Variable_name)
Number-String Conversion Functions Source_data_type_TO_STRING (Variable_name)
STRING_TO_New_data_type (Variable_name)
Function Argument data type Return value
data type
Description Example
ABS (argument) INT, DINT, LINT,
UINT, UDINT, ULINT,
REAL, LREAL
INT, DINT, LINT,
UINT, UDINT,
ULINT, REAL,
LREAL
Absolute value [argu-
ment]
a: = ABS (b)
(*absolute value of variable
b stored in variable a*)
SQRT (argument) REAL, LREAL REAL, LREAL Square root:
√ argument
a: = SQRT (b)
(*square root of variable b
stored in variable a*)
LN (argument) REAL, LREAL REAL, LREAL Natural logarithm: LOG
e
argument
a: = LN (b)
(*natural logarithm of vari-
able b stored in variable a*)
LOG (argument) REAL, LREAL REAL, LREAL Common logarithm:
LOG
10
argument
a: = LOG (b)
(*common logarithm of vari-
able b stored in variable a*)
EXP (argument) REAL, LREAL REAL, LREAL
Natural exponential: e
ar-
gument
a: = EXP (b)
(*natural exponential of vari-
able b stored in variable a*)
SIN (argument) REAL, LREAL REAL, LREAL Sine: SIN argument a: = SIN (b)
(*sine of variable b stored in
variable a*)
COS (argument) REAL, LREAL REAL, LREAL Cosine: COS argument a: = COS (b)
(*cosine of variable b stored
in variable a*)
TAN (argument) REAL, LREAL REAL, LREAL Tangent: TAN argument a: = TAN (b)
(*tangent of variable b stored
in variable a*)
ASIN (argument) REAL, LREAL REAL, LREAL
Arc sine: SIN
−
1
argument
a: = ASIN (b)
(*arc sine of variable b
stored in variable a*)
ACOS (argument) REAL, LREAL REAL, LREAL
Arc cosine: COS
−
1
argu-
ment
a: = ACOS (b)
(*arc cosine of variable b
stored in variable a*)
ATAN ( argument) REAL, LREAL REAL, LREAL
Arc tangent: TAN
−
1
argu-
ment
a: = ATAN (b)
(*arc tangent of variable b
stored in variable a*)