Bug #74254 [Opn->Nab]: Data judgment problem
Edit report at https://bugs.php.net/bug.php?id=74254&edit=1
ID: 74254
Updated by: jhdxr@php.net
Reported by: 290605830 at qq dot com
Summary: Data judgment problem
-Status: Open
+Status: Not a bug
Type: Bug
Package: Output Control
Operating System: windows 7
PHP Version: 7.0.16
Block user comment: N
Private report: N
New Comment:
Floating point values have a limited precision. Hence a value might
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly
printing it without any mathematical operations.
If you would like to know more about "floats" and what IEEE
754 is, read this:
http://www.floating-point-gui.de/
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2017-03-16 03:40:54] 290605830 at qq dot com
Description:
------------
162.95 multiplied by 100 and not equal to 16295, the other digits tested were normal
Test script:
---------------
$a = 162.95;
$b = 16295;
$c = (double)($a*100);
$b = (double)$b;
if($c!=$b)
{
echo "<br/>not eq ,c=".$c.",b=".$b;
}else{
echo "eq";
}
Expected result:
----------------
The result of running this script should be equal
Actual result:
--------------
Actual results are not equal
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74254&edit=1
Thread (2 messages)