[futurebasic] Re: [FB] Rounding Rule

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2005 : Group Archive : Group : All Groups

From: tedd <tedd@...>
Date: Tue, 6 Dec 2005 08:34:50 -0500
>Re rounding problems and its effects...
>
>My approach was to have my own rounding function to be used on the 
>results of ALL calculations. It's an old method - just add 1/2 of 
>the next decimal position to the value and then chop (truncate) the 
>unneeded decimal places. Then use PRINT USING to display the results 
>as required. (or use LET x$ - USING...) if desired.

Your approach is fine for probably most applications. The problem 
arises from always *adding* to make the round determination. It might 
not show itself as a problem, but I think intuitively one can 
visualize that if a rule is "when in doubt, always make it larger 
first and then test", will lead to a bias for the resultant data-set 
to be larger than it actually is.

This isn't just my idea, it's pretty well documented

There are three basic rules for rounding (taken from a Google search).

Rule 1- if the remainder beyond the last digit to be reported is less 
than 5, drop the last digit. Rounding to one decimal place, the 
number 5.3467 becomes 5.3.
	 
Rule 2 - if the remainder is greater than 5, increase the final digit 
by 1. The number 5.798 becomes 5.8 if rounding to 1 digit.
	 
Rule 3 - To prevent rounding bias, if the remainder is exactly 5, 
then round the last digit to the closest even number. Thus the number 
3.55 (rounded to 1 digit) would be 3.6 (rounding up) and the number 
6.450 would round to 6.4 (rounding down) if rounding to 1 decimal.

See page 12 in Hurlburt, R. (1994) Comprehending Behavioral 
Statistics, Brooks/Cole, Pacific Grove, CA.

Another solution could be to randomly chose to add or subtract and do 
what you suggest. Or another rule could be just to look at the whole 
number and if it's even then add or if it's odd, then subtract.

The point is, under certain conditions (i.e., when last digit is 
exactly 5) then rounding only one way will lead to a rounding bias.

tedd
-- 
--------------------------------------------------------------------------------
http://sperling.com/