VBScript CLng Function

Definition and Usage

The CLng function can convert an expression to a long integer (Long) type.

Note:The value must be a number between -2147483648 and 2147483647.

Note:CLng is different from the Fix and Int functions in that it removes the decimal part by rounding, rather than truncating. When the decimal part is exactly 0.5, the CLng function always rounds it to the nearest even number. For example, 0.5 rounds to 0, and 1.5 rounds to 2.

Syntax

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

Instance

Example 1

dim a,b
a=23524.45
b=23525.55
document.write(CLng(a))
document.write(CLng(b))

The output is as follows:

23524
23526