Doc->Bug #70954 [Opn->Nab]: Wrong Calculation
| From: | requinix@php.net | Date: | Sun, 22 Nov 2015 20:43:41 +0000 |
| Subject: | Doc->Bug #70954 [Opn->Nab]: Wrong Calculation | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-197371@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70954&edit=1
ID: 70954
Updated by: requinix@php.net
Reported by: sukram230799 at outlook dot com
Summary: Wrong Calculation
-Status: Open
+Status: Not a bug
-Type: Documentation Problem
+Type: Bug
Package: *General Issues
Operating System: Window 10
PHP Version: 5.6.15
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:
------------------------------------------------------------------------
[2015-11-22 15:08:52] sukram230799 at outlook dot com
Description:
------------
---
From manual page: http://www.php.net/index
---
PHP is calculating wrong or inacurate.
Test script:
---------------
echo(272.19-273.15);
Expected result:
----------------
-0.96
Actual result:
--------------
-0.95999999999998
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70954&edit=1