# Math Ceil (), floor (), round () method

Source: Internet
Author: User

Http: // 221.199.150.103/JSJ/html/page/book/JS/j_math_ceil.htm Math Ceil () , Floor () , Round () Method

 Math. Ceil () Function:The number is rounded up.Syntax:Math. Ceil (X)Parameters: X: A value. Return Value:Returns an integer that is greater than or equal to X and closest to the nearest value.Note:If X is a positive number, the decimal number is "in". If X is a negative number, the decimal number is "out ". Example: the output result is:Document. write (math. ceil (1.2) + "," + math. ceil (1.8) + "," + math. ceil (-1.2) + "," + math. ceil (-1.8 ));2, 2,-1,-1

 Math. Floor () Function:Perform a rounded down operation on a number.Syntax:Math. Floor (X)Parameters: X: A value. Return Value:Returns an integer that is less than or equal to X and closest to X.Note:If X is a positive number, the decimal number is "included". If X is a negative number, the decimal number is "in ". Example: the output result is:Document. write (math. floor (1.2) + "," + math. floor (1.8) + "," + math. floor (-1.2) + "," + math. floor (-1.8 ));1, 1,-2,-2

 Math. Round () Function:Rounding.Syntax:Math. Round (X)Parameters: X: A value. Return Value:The nearest integer to X. Example: the output result is:Document. write (math. round (1.2) + "," + math. round (1.8) + "," + math. round (-1.2) + "," + math. round (-1.8 ));1, 2,-1,-2
Related Keywords:

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.