int((0.1+0.7)*10) = 7 in several languages. How to prevent this?
问题 Recently I came across a bug/feature in several languages. I have a very basic knowledge about how it's caused (and I'd like some detailed explanation), but when I think of all the bugs I must have made over the years, the question is how can I determine " Hey, this might cause a riddiculous bug, I'd better use arbitrary precision functions ", what other languages do have this bug (and those who don't, why ). Also, why 0.1+0.7 does this and i.e. 0.1+0.3 doesn't, are there any other well-known