Created
March 26, 2013 15:53
-
-
Save iNem0o/5246530 to your computer and use it in GitHub Desktop.
Go home PHP, you're drunk !
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$a = 10+25.99+0.01; | |
echo '<br>$a = 10+25.99+0.01 = 36'; | |
echo '<br>round($a) = '.round($a); | |
echo '<br>$a - round($a) = '.($a-round($a)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This isn't specific to PHP and it's not a bug. You get the same result in Python, Javascript, Ruby. It's due to floating point arithmetic.