Home > Language Reference > Functions > Data Types
CSng Function
Conversion into a Single type.
Syntax
CSng( Expression )
| Parameter | Description |
| Expression | Expression to convert into a Single type. |
Remarks
The CSng reserved keyword is syntactically equivalent to a function returning a Single type, and can be used everywhere that a function is accepted.
Only Boolean, Date type expressions and object references cannot be converted into type Single. All attempts to use this keyword on one of these expressions will cause a runtime error.
At runtime, when Expression is a string (or a Variant containing a string), it should not contain thousands separators and the decimal separator should be a decimal point. If necessary, you can use the DelocalizeNumber function to check it.
When Expression is a decimal value not exactly representable in the IEEE-754 format, it is rounded to the nearest representable value. Type Single only allows around 7 significant figures and it can result in a notable loss of precision.
In all cases, a runtime error will occur if Expression cannot be converted into a numeric value whose absolute value is less than 3.402823567797336E38.
System requirements
| System | Minimal version | Remarks |
| Palm OS | Palm OS 3.0 | - |
| Windows CE | Windows CE 3.0 | - |