Tuesday 8 January 2019

language agnostic - Is floating point math broken?

Consider the following code:



0.1 + 0.2 == 0.3  ->  false


0.1 + 0.2         ->  0.30000000000000004



Why do these inaccuracies happen?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...