Groups | Blog | Home
all groups > dotnet sdk > january 2006 >

dotnet sdk : Obscure rounding in .NET



eXavier
1/25/2006 7:00:02 AM
Hello,
we just figured out that there is some obscure rounding algorithm
implemented in .NET framework (e.g. 0.05 rounded to 1 decimal digit is 0.0
instead of 0.1). Although the behaviour is described in MSDN, it is so
unexpected that we didn't noticed it and we used it in an application. In
financial application. What a faux pass! When we wanted to fix this, we were
looking for some setting to switch to standard rounding but surprisingly we
found nothing. This is very strange - rounding is quite common operation. Is
there another library for standard rounding? What is the "rounding toward
even" algorithm good for? And why it is implemented in standard library
instead of normal rounding algorithm?

Thanks,
Christopher Reed
1/25/2006 2:33:54 PM
In the .NET 2.0 Framework, it appears that these issues have been addressed.
You might look at the MSDN documentation for .NET 2.0 for more information.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

[quoted text, click to view]

AddThis Social Bookmark Button