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:[EMAIL PROTECTED]]
> Sent: Thursday, June 27, 2002 1:24 AM
> To: [EMAIL PROTECTED]
> 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
> [EMAIL PROTECTED]
> http://lists.runrev.com/mailman/listinfo/metacard
> 
_______________________________________________
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard

Reply via email to