this question has answer here:
- is floating point math broken? 20 answers
the following output surprised me:
1.1 + 2.2 => 3.3000000000000003 an unexpected small digit came sum. same not happen other addends, e.g.:
3.0 + 0.3 => 3.3 i tried both in python 2.7 , in 3.4, result same. reason unexpected result of sum?
mainly because binary doesn't play decimal (2 , 10 coprime) , floats have limited precision.
Comments
Post a Comment