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.