I am trying to establish the delta I need when doing float comparison in PHP. I want to take a closer look at my variables to see the difference.
I have 2 computed variables, $a, $b.
$a = some_function();
$b = some_other_function();
How can I see the exact number which PHP uses?
I want to compare them with this formula, where I need to specify the delta:
$delta = 0.00001;
if (abs($a-$b) < $delta) {
echo "identical";
}
var_dump($a, $b) returns 1.6215; 1.6215. but I know that they are not exactly equal because
var_dump($a === $b);
evaluates to false;
Why doesn't var_dump()
print the internal value?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…