VBScript CSng Function

Definition and Usage

The CSng function can convert an expression to a single-precision (Single) type.

Note:An error occurs if the expression is outside the range allowed by the Single subtype.

Syntax

CSng(expression)
Parameter Description
expression Required. Any valid expression.

Instance

Example 1

dim a,b
a=23524.4522
b=23525.5533
document.write(CSng(a) & "<br />")
document.write(CSng(b))

The output is as follows:

23524.45
23525.55