New answers tagged

7

The problem is that float numbers are seldom an exact representation. So the float is stored as the closest number that is exactly representable as a float, namely 10446438 × 2−18 = 39.84999847412109375. When you multiply this by 100, you get 16322559 × 2−12 = 3984.999755859375. And than casting to an int or long results in 3984, not 3985. so whenever you ...


Top 50 recent answers are included