Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP/VBScript - Int() vs CInt()

Tags:

What is the difference in ASP/VBScript between Int() and CInt()?

like image 404
Seibar Avatar asked Aug 21 '08 18:08

Seibar


People also ask

What is CInt in vbscript?

The CInt function converts an expression to type Integer. Note: The value must be a number between -32768 and 32767.

What is CInt function?

The CInt function converts an expression to an integer. You can use any valid numeric or string expression, but the string expression must be able to be converted to a number.


1 Answers

  • Int()

The Int function returns the integer part of a specified number.

  • CInt()

The CInt function converts an expression to type Integer.

And the best answer comes from MSDN

CInt differs from the Fix and Int functions, which truncate, rather than round, the fractional part of a number. When the fractional part is exactly 0.5, the CInt function always rounds it to the nearest even number. For example, 0.5 rounds to 0, and 1.5 rounds to 2.

like image 197
Pascal Paradis Avatar answered Oct 02 '22 02:10

Pascal Paradis