PREMISE

Rounding numbers will introduce a bias if done incorrectly. Round off error is inevitable, but bias is not.

DISCUSSION

The following algorithm has been proposed for the rounding of numbers to n significant figures. This method has the advantage of reducing the bias that may accumulate when the discarded portion of the number is exactly one-half a unit in the nth place. The method is useful in that it increases the accuracy of scientific research data.

The algorithm would also be of use in financial transactions, where the accumulation of error could potentially add up to big bucks. Imagine; a penny here, a penny there, soon you have two cents.

The resulting number can be said to be well rounded.

ALGORITHM

   To round a number to n significant figures, discard all
   digits to the right of the nth place. If the discarded
   number is less than one-half a unit in the nth place, leave
   the nth digit unchanged. If the discarded number is greater
   than one-half a unit in the nth place, increase the
   nth digit by 1. If the discarded number is exactly one-half
   a unit in the nth place, leave the nth digit
   unchanged if it is an even number and add 1 to it if it is odd.

   -- Measurement Systems: Application and Design, Doebelin, Ernest O., page 61.
     Copyright 1975 McGraw-Hill, Inc.

EXAMPLES

The following examples illustrate the major points of the algorithm.

  1. Round 1.23456 to 3 significant digits.

    Discard all digits to the right of the 3rd place. Since 0.00456 is less than half of 0.01, the 3rd digit remains unchanged.

    Result: 1.23.

  2. Round 1.23678 to 3 significant figures.

    Discard all digits to the right of the 3rd place. Since 0.00678 is greater than half of 0.01, the 3rd digit is increased by 1.

    Result: 1.24.

  3. Round 1.245 to 3 significant figures.

    Discard all digits to the right of the 3rd place. Since 0.005 is exactly half of 0.01, and since the 3rd digit is even, the 3rd digit remains unchanged.

    Result: 1.24

  4. Round 1.275 to 3 significant figures.

    Discard all digits to the right of the 3rd place. Since 0.005 is exactly half of 0.01, and since the 3rd digit is odd, the 3rd digit is increased by 1.

    Result: 1.28

CONCLUSION

I hope this is useful and not pedantic.

Log in or registerto write something here or to contact authors.