Int Function

Tips >>ASP Functions

WANTS TO MAKE SOFTWARE WITHOUT KNOWLEDGE OF ASP? CLICK HERE

The Int function returns the integer part of a specified number. The Int function converts a decimal number (floating-point) to an integer number (fix-point). There is one major difference between Int and Fix. Int rounds negative numbers down. Fix rounds negative numbers up. The number argument can be any valid numeric expression. If number contains Null, Null is returned. Int remove the fractional part of number and return the resulting integer value. Int returns the first negative integer less than or equal to number. For example, Int converts -8.4 to -9. Int and Fix are interchangeable except when the number is negative, Int returns the first negative integer less than or equal to number.
Note :-
If the number parameter contains Null, Null will be returned.

The Syntax of Int function is :-

Int(number)

Example#1 :-

Code :-
document.write(Int(6.83227))
Output :-

6

Example#2 :-

Code :-
document.write(Int(6.23443))
Output :-

6

Example#3 :-

Code :-
document.write(Int(-6.13443))
Output :-

-7

Example#4 :-

Code :-
document.write(Int(-6.93443))
Output :-
-7

Example#5 :-

Code :-
<% =Int(123.456) %>
Output :-
123

Note :- Positive numbers are not rounded up. The decimal point and all digits to the right are effectively chopped off.

Example#6 :-

Code :-
<% =Int(123.899) %>
Output :-
123

Note :- Negative numbers are rounded down (towards more negative)

Example#7 :-

Code :-
<% =Int(-123.456) %>
Output :-
-124

 

 
E-mail : sales@virtualsplat.com
Phone : +91-9892413501

Whatsapp Icon +91-9967648641

Whatsapp Icon +91-9967648641