Update cookies preferences
Promotic

CSng - function of language VBScript

Description:
Returns an expression that has been converted to the value of the Single type.
In the PROMOTIC system it is better to use the Pm.ToNumber method.
Syntax:
Single CSng(Variant expression)
Parameters:
expression(Variant) Any valid expression.
Note:
The conversion functions can be used e.g. if you want some operation result to be expressed as a particular data type (rather than the default data type of the operation). For example, use CDbl or CSng functions to force double-precision or single-precision arithmetic in cases where integer arithmetic normally would occur.
Use the CSng function to provide internationally aware conversion from any other data type to the value of the Single type. For example, different decimal separators and thousands separators are properly recognized depending on the locale setting of Windows system.
If expression lies outside the acceptable range of the Single type, then an error occurs.

Caution: This function can convert only values with separators set locally (e.g. value 3.14 or 3,14). Therefore a problem arises when values in the text form originate on another computer with different setting. That's why it is recommended the Pm.CSng method that solves this problem!
Example:
VBScriptSelect and copy to clipboard

Dim n
n = CSng(75.3421115)   ' Returns 75.34211
n = CSng(75.3421555)   ' Returns 75.34216
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.