Ceil round floor

Source: Internet
Author: User
Tags floor function

 

Ceil is the "ceiling"
The floor is a "floor" top-up value, and the other bottom-up value, like a ceiling, floor.

 

 

 

Double floor (Double X );

Double Ceil (Double X );

Use the floor function.

Floor (x) returns the largest integer less than or equal to X.

For example, floor (10.5) = 10 floor (-10.5) =-11

 

Use the ceil function.

Ceil (x) returns the smallest integer greater than X.

For example, Ceil (10.5) = 11 Ceil (-10.5) =-10

 

Floor () is an integer down, floor (-10.5) =-11;

Ceil () is rounded up, Ceil (-10.5) =-10

 

 

 

Ceil (x) returns the smallest integer not less than X (then converted to double type ).

 

Floor (x) returns the maximum integer not greater than X.

 

Round (x) returns x rounded to an integer.

 

 

 

 

# Include <stdio. h>

 

# Include <math. h>

 

Int main (INT argc, const char * argv [])

 

{

 

Float num = 1.4999;

 

Printf ("Ceil (% F) is % F \ n", num, Ceil (Num ));

 

Printf ("floor (% F) is % F \ n", num, floor (Num ));

 

Printf ("round (% F) is % F \ n", num, round (Num ));

 

Return 0;

 

}

 

 

 

 

Ceil (1, 1.499900) is 2.000000

 

Floors (1.499900) is 1.000000

 

Round (1.499900) is 1.000000

 

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.