Skip to content

Instantly share code, notes, and snippets.

@iNem0o
Created March 26, 2013 15:53
Show Gist options
  • Save iNem0o/5246530 to your computer and use it in GitHub Desktop.
Save iNem0o/5246530 to your computer and use it in GitHub Desktop.
Go home PHP, you're drunk !
$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));
@jaden
Copy link

jaden commented Dec 29, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment