Skip to content

Instantly share code, notes, and snippets.

@kyrozetera
Created July 6, 2016 21:47
Show Gist options
  • Save kyrozetera/f16543e9dcb317696429f3d3531d3ecd to your computer and use it in GitHub Desktop.
Save kyrozetera/f16543e9dcb317696429f3d3531d3ecd to your computer and use it in GitHub Desktop.
Floating Point Fun
$thing = 50 * (1.1);
var_dump($thing);
var_dump(55 == $thing);
/* Output:
* float(55)
* bool(false)
*/
$thing = 50 + (50 * (.1));
var_dump($thing);
var_dump(55 == $thing);
/* Output:
* float(55)
* bool(true)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment