IT Readings Log   

Thursday, November 17, 2005

(Complete) Tutorial to Understand IEEE Floating-Point Errors

If you are trying to build some complex math functions in C#, using various data types and trying to keep a very good precision on those numbers... well... good luck!

There are several things to consider, probable several articles to read. Here it is one that explains why this code:

item1# = 69.82#
item2# = 69.20# + 0.62#
IF item1# = item2# then print "Equality!"

will NOT print "Equality!", in other words 69.82# not equal with 69.20# + 0.62#

http://support.microsoft.com/kb/q42980/

Thank you Laur for another revealing article...

0 Comments:

Post a Comment

<< Home