Visual Studio 2010 C# Double -
i've had problems while converting decimal double in c#. instead of 0.3 getting 0.2999999999999
when debug little bit, i've seen conversion not problem.
see print screen , watch list? http://i.imgur.com/rtudfxo.png
anyone has idea?
edit: answer: strange behavior of visual studio 2010. after restarting fine.
0.3 has infinite representation, when stored binary: (0.) 00111111 11010011 00110011 00110011 00110011 00110011 00110011 00110011 ..... no matter if store 32,64 or 128 bit, cut off @ point.
when converting double loose accuracy. that's why getting 0.2999999999...
this not bug, simple impossible store infinite accuracy.
Comments
Post a Comment