Why does $x1
not equal $z2
? I've tried round()
as well as explicitly changing the precision to 8
. $x1
should equal $z2
$x1 = 251.47267993;
$y1 = 3861.62758730;
$z1 = $x1 / $y1;
echo "{$x1} / {$y1} = {$z1}\n\n"; // ok looks good
$x2 = .06512090;
$y2 = 3861.62758730;
$z2 = $x2 * $y2;
echo "{$x2} x {$y2} = {$z2}\n\n"; // hmm no - $z2 should be === to $x1
// why do these numbers NOT match? and how can I make them match?
// set some precision somewhere?
echo $x1 . " = " . $z2 . "\n";
More info:
_251.47267993_ /3861.62758730 =.06512090
.06512090 *3861.62758730 =_251.47266394_
251.47267993 - 251.47266394 = .00001599
Note that the 2 underlined numbers should be identical we divided then multiplied by the same number. Should be inverses ... right ... but not when we don't have an infinite number of digits to play with - as is, they are not even close, they differ by "0.00001599"