Edit report at https://bugs.php.net/bug.php?id=74347&edit=1
ID: 74347
Updated by: [email protected]
Reported by: stefan at van-echtelt dot nl
Summary: -1 - 0.1 + 1 + 0.1 bugg
-Status: Open
+Status: Not a bug
Type: Bug
Package: Output Control
Operating System: Windows
PHP Version: Irrelevant
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-31 09:17:42] stefan at van-echtelt dot nl
Description:
------------
$test = -1 - 0.1 + 1 + 0.1;
print $test;
if you print this in php the value will be -8.3266726846887E-17.
It should be 0.
Test script:
---------------
$test = -1 - 0.1 + 1 + 0.1;
print $test;
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74347&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.