为什么从floatval()获得的值在与另一个数字进行比较时评估为false?

Ian*_*Ian 2 php floating-point comparison

请参阅下面的测试用例:

$val = floatval("336.00");
$result = 300*1.12;

header("content-type: text/plain");

echo "\$result = 300*1.12 which equals $result\n";
echo "\$val = floatval(\"336.00\") which equals $val\n";
echo "gettype(\$val) = ".gettype($val)."\n";
echo "gettype(\$result) = ".gettype($result)."\n";
echo "gettype(300*1.12) = ".gettype(300*1.12)."\n";
echo "gettype(floatval(\$result)) = ".gettype(floatval($result))."\n";

if ($result == 300*1.12) 
    echo "\$result == 300*1.12 is true\n";
else
    echo "\$result == 300*1.12 is false\n";

if ($result == $val) 
    echo "(\$result == \$val) \$result == 300*1.12 is true\n";
else
    echo "(\$result == \$val) \$result == 300*1.12 is false\n";
Run Code Online (Sandbox Code Playgroud)

您认为最后一个if/else块也会显示为true,对吗?不是这样!查看同一脚本的输出:

$result = 300*1.12 which equals 336
$val = floatval("336.00") which equals 336
gettype($val) = double
gettype($result) = double
gettype(300*1.12) = double
gettype(floatval($result)) = double
$result == 300*1.12 is true
($result == $val) $result == 300*1.12 is false
Run Code Online (Sandbox Code Playgroud)

我在这里错过了什么?我已经尝试过各种版本的PHP 5+,它们都产生相同的输出.