Is floating point math broken?
Asked 07 September, 2021
Viewed 1.4K times
  • 61
Votes

Consider the following code:

0.1 + 0.2 == 0.3  ->  false
0.1 + 0.2         ->  0.30000000000000004

Why do these inaccuracies happen?

30 Answer