The Round/ceil/floorf function in iOS is slightly solved

Source: Internet
Author: User

extern float Ceilf (float);

extern double ceil (double);

extern long double Ceill (long double);

extern float Floorf (float);

extern double floor (double);

extern long double floorl (longdouble);

extern float roundf (float);

extern double round (double);

extern long double Roundl (longdouble);

Round: If the parameter is a decimal, then the rounding of itself is asked. Ceil: If the parameter is a decimal, the smallest integer is not less than itself. Floor: If the parameter is a decimal, the largest integer is not greater than itself.

Example: How the value is 3.4, then

3.4--round 3.000000

--Ceil 4.000000

-Floor 3.00000

CGRectMake (Floorf (self.view.bounds.size.width*0.5f-39.f*0.5f), self.view.bounds.size.height-57, 39, 39)

where Floorf (self.view.bounds.size.width*0.5f-39.f*0.5f) returns a value of

140.000000 this form

The Round/ceil/floorf function in iOS is slightly solved

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.