Paper 11:matlab fix function, floor function, ceil function, round function distinction

Source: Internet
Author: User
Tags floor function

1)fix (N) rounding in the 0 direction , which is a class of functions applied to integer values, as in the previous study of the rounding problem, for example, Fix (PI) =3; fix ( -1.3) =-1; fix (1.3) =1;

2)
round (n): rounded to the nearest integer, such as round ( -1.3) =-1;round ( -1.52) =-2;round (1.3) =1;round (1.52) =2;round(PI) =3 ; round (3.5) =4;round (-3.5) =-4;
Round (-3.1) =-3; This note differs from fix, pay attention to the distinction!


3
Floor (n), as the name implies, is the flooring, so it is smaller than its whole number, that is, toward the negative infinity direction, such as floors (-1.3) =-2; Floor (1.3) =1;floor ( -1.8) =-2,floor (1.8) =1
Ceil function, in contrast to floor, it means the ceiling, that is, to take a larger than its smallest integer, that is, toward the positive infinity direction, such as ceil (-1.3) =-1; Ceil (1.3) =2;ceil ( -1.8) =-1,ceil (1.8) =2

4)
ceil (n) means rounding in the positive direction, which is better differentiated with floor (n) rounding in the negative direction, for example:
Ceil (PI) =4; ceil (3.5) = 4; Ceil (-3.2) =-3; Rounding in the positive direction
Floor (PI) = 3; Floor (3.5) = 3; Floor (-3.2) =-4; rounding in negative direction

So it is easy to tell the difference, I hope we can distinguish;

Paper 11:matlab fix function, floor function, ceil function, round function distinction

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.