WPS Table Numerical rounding function Grand Parade

Source: Internet
Author: User
Tags integer rounds

In the numerical calculation process, often encounter the case of rounding the results, the WPS table provides a rich rounding function, the following we have a big parade of these functions:

CEILING

Rounds the first parameter value up (in the direction of the absolute value increase) to a multiple of the nearest second parameter. For example, the result of =ceiling (4.42,0.3) is a multiple of 0.3 4.5;=ceiling (-4.42,-0.3) resulting in a multiple of 0.3-4.5. If the first argument is already a multiple of the second argument, the result is the original number. Note that two parameter symbols are the same, and a positive or negative error occurs.

Even

Returns the nearest even number that is rounded up in the direction of the absolute increase. As =even (1.5) The result is 2,=even (-3) The result is-4.

If the argument happens to be an even number, the result is the original.

ODD

Returns the odd number after the specified value is rounded up. As =even (1.5) The result is 3,=even (-4) The result is-5.

If the argument happens to be odd, the result is the original number.

FLOOR

Rounds the first argument down in the direction of decreasing the absolute value so that it equals the multiple of the nearest second parameter. As =floor (0.1234,0.01) result is 0.12,=floor ( -1234,-10) The result is-1230. If the two parameter symbols are reversed, the function returns an error value. If the first argument happens to be a multiple of the second argument, the result is the original number.

Int

Rounds the number down to the nearest integer. As =int (5.99) The result is 5,=int (-5.99) The result is-6.

ROUND

Returns the number of the first argument rounded off by the number of digits specified by the second argument. If the result of =round ( -1.475,2) is -1.48,=round (1.475,0) The result is 1,=round (475,-1) The result is 480. Note that if the second argument is less than 0, rounding is to the left of the decimal point.

RoundDown

Close to 0, rounding the number downward (in the direction of decreasing absolute value) (equivalent to the usual method of tail). As =rounddown (3.14159,3) result is 3.141,=rounddown ( -3.14159,3) The result is -3.141,=rounddown (2345,-1) The result is 2340. Note that if the second argument is less than 0, rounding is to the left of the decimal point.

ROUNDUP

The number is rounded away from the 0 value, up (in the direction of absolute growth) (equivalent to the usual approach). As =roundup (3.14159,2) result is 3.15,=roundup ( -3.14159,2) The result is -3.15,=roundup (2345,-1) The result is 2350. Note that if the second argument is less than 0, rounding is to the left of the decimal point.

TRUNC

Truncate the first argument by the number of digits specified in the second argument, which is essentially the same as RoundDown, but Trunc can omit the second argument (at this point, the integer). =trunc (8.9) The result is 8,=trunc (-8.9) The result is -8,=trunc (3.1415,2) and the result is 3.14.

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.