a good one
Yates, Glen
JAMES.G.YATES at saic.com
Thu Jun 27 10:12:01 EDT 2002
What problem?
82.845 rounded to 2 decimal places should round to 82.84
Whereas, 82.835 would also round to 82.84
The rule is whenever you have a perfect half (i.e. the last significant
digit is a 5) and you are rounding to the next digit, then you should round
to the nearest even number. That way sometimes you round up and sometimes
down. This gives a more statistically valid rounding.
Think about it, if you use the more simplistic method of always rounding
perfect halves up, then you artificially skew your data upward. Perfect
halves are exactly half way between the next lower number and the next
higher one, so why would you always round up? The higher number is no closer
than the lower one.
-Glen Yates
> -----Original Message-----
> From: andu [mailto:undo at cloud9.net]
> Sent: Thursday, June 27, 2002 1:24 AM
> To: metacard at lists.runrev.com
> Subject: a good one
>
>
> Off /.
>
> "During my few years as a programmer/developer I've come across some
> strange bugs. Recently I found that Microsoft's VB/VBScript(ASP)
> round function has problems (for example, 'round(82.845)'
> returns '82.84'
> instead of '82.85'). It took me an annoyingly long time to
> realize the
> problem wasn't mine."
>
>
> Regards, Andu Novac
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard
>
More information about the metacard
mailing list