ASP Math Function

Math functions are part of our ASP scripts. Mostly they are used within the applications and support the script with various features. We will discuss some common functions used frequently inside our code.

Int function to get Integer part
From any number we can get the integer part only by using int function . Here are some values returned by int function.

Int ( 4.0 ) will return 4
Int ( 4.1 ) will return 4
Int ( 4.9 ) will return 4
Int ( 4.5 ) will return 4
Int ( 1.1 ) will return 1
Int ( 0 ) will return 0
Int ( -0.1 ) will return -1
Int ( -2.1 ) will return -3
Int ( -2.9 ) will return -3

Mod function to get the reminder of division

We can get the reminder after a division is by using mod function. Here is the code

Dim my_num1,my_num2

Response.Write my_num1 mod my_num2

The output of above line is 0. If we change the value of my_num1 to 55 then the output will change to 5.

Be the first to post comment on this article :

Further readings
Round function to format decimal place in a number
Math functions INT
Random Number generator using Random function
Percentage value by using FormatPerecnt function

Post your comments , suggestion , error , requirements etc here .

We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2022 All rights reserved worldwide Privacy Policy Disclaimer