Skip to content

Instantly share code, notes, and snippets.

@scottrobertson
Created March 23, 2014 13:00
Show Gist options
  • Save scottrobertson/9722759 to your computer and use it in GitHub Desktop.
Save scottrobertson/9722759 to your computer and use it in GitHub Desktop.
<?php
$value1 = 0.0116;
$value2 = 0.01158;
echo $value1 - $value2; // 1.9999999999999E-5
@phpcodemonkey
Copy link

Use bcmath library:

bcscale(6);
echo bcsub($value1, $value2); // 0.000020

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