CLng - function of language VBScript

Returns an expression that has been converted to type Long.
CLng(expression As Variant) As Long
n = CLng(expression)
expression(Variant) Any valid expression.

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). For example, use CInt or CLng to force integer arithmetic in cases where single-precision, or double-precision arithmetic normally would occur.

Use the CLng function to provide internationally aware conversions from any other data type to a Long type. For example, different decimal separators are properly recognized depending on the locale setting of your system, as are different thousand separators.

Note: CLng function differs from the Int and Fix functions, which truncate, rather than round, the fractional part of a number. When the fractional 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.

Dim nVal1, nVal2, nLong1, nLong2
nVal1 = 25427.45: nVal2 = 25427.55
nLong1 = CLng(nVal1) 'nLong1 contains 25427
nLong2 = CLng(nVal2) 'nLong2 contains 25428
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice