Several integer functions in ASP

Source: Internet
Author: User

 

Several integer functions in ASP are: Fix (), INT (), round ();
The int (number) and fix (number) functions return the integer part of the number. The number parameter can be any valid numeric expression. If the Number Parameter contains null, null is returned.
Example:
Response. Write int (2.14) '2
Response. Write fix (2.14) '2
Response. Write int (2.54) '2
Response. Write int (2.54) '2
Both the int and fix functions Delete the fractional part of the Number Parameter and return the result expressed as an integer. The difference between the int and fix functions is that if the number parameter is negative, the int function returns the first negative integer less than or equal to the number, and the fix function returns the first negative integer greater than or equal to the number parameter. For example, int converts-8.4 to-9, and the fix function converts-8.4 to-8.

Round (expression [, numdecimalplaces]) returns the value rounded by the specified number of digits. Expression is required. The numeric expression is rounded down. Numdecimalplaces is optional. Number indicates the number of digits to the right of the decimal point. If this parameter is omitted, the round function returns an integer.
Example:
Response. Write round (3.14) '3
Response. Write round (3.55) '4
Response. Write round (3.1415, 3) '123'

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.