Print this page

Rounding off decimal numbers

Knowledge Article Number 000199522
Description Rounding off number seem to be incorrect. Certain numbers seem to be increased by 1.
Resolution Salesforce uses the following mechanism in rounding off numbers.

When the number to be rounded off has a value less than five (5) in the last decimal place, the number is just dropped off and rest of the original value is kept as is.
But when the number to be rounded off has 5 or more as the last decimal place add one to the last but one decimal place.

Following 3 example should make this clear

1.234 when rounded to the nearest 2 decimal place will yield 1.23 since the number to be dropped off is 4 (less than 5)
1.235 when rounded to the nearest 2 decimal places will yield 1.24 since the number in the last place is 5
1.295 when rounded off the nearest 2 decimal places will yield 1.3

Note this is the simplified version of rounding off numbers as compared to the conventional:
 
CASE A:
In rounding off numbers, the last figure kept should be unchanged if the first figure dropped is less than 5.
For example, if only one decimal is to be kept, then 6.422 becomes 6.4.
CASE B:
In rounding off numbers, the last figure kept should be increased by 1 if the first figure dropped is greater than 5.
For example, if only two decimals are to be kept, then 6.4872 becomes 6.49. Similarly, 6.997 becomes 7.00.
CASE C:
In rounding off numbers, if the first figure dropped is 5, and all the figures following the five are zero or if there are no figures after the 5, then the last figure kept should be unchanged if that last figure is even.
For example, if only one decimal is to be kept, then 6.6500 becomes 6.6.

For example, if only two decimals are to be kept, then 7.485 becomes 7.48.

CASE D:
In rounding off numbers, if the first figure dropped is 5, and all the figures following the five are zero or if there are no figures after the 5, then the last figure kept should be increased by 1 if that last figure is odd.
For example, if only two decimals are to be kept, then 6.755000 becomes 6.76.

For example, if only two decimals are to be kept, 8.995 becomes 9.00.

CASE E:
In rounding off numbers, if the first figure dropped is 5, and there are any figures following the five that are not zero, then the last figure kept should be increased by 1.
For example, if only one decimal is to be kept, then 6.6501 becomes 6.7.

For example, if only two decimals are to be kept, then 7.4852007 becomes 7.49.





promote demote