Bug #72487 [NEW]: 100 - 99.6 why result = 0.400000001
| From: | wee_weerapat at hotmail dot com | Date: | Fri, 24 Jun 2016 11:37:28 +0000 |
| Subject: | Bug #72487 [NEW]: 100 - 99.6 why result = 0.400000001 | ||
| Groups: | php.standards | ||
| Request: | Send a blank email to standards-+get-1094@lists.php.net to get a copy of this message | ||
From: wee_weerapat at hotmail dot com
Operating system: Mac & Windows
PHP version: 5.5.37
Package: PHP Language Specification
Bug Type: Bug
Bug description:100 - 99.6 why result = 0.400000001
Description:
------------
I'm not sure. 100-99.6 the result will return 0.400000001
and i try many case 100 - 99.96 the result still same 0.040000000000006
There return another position of number
Test script:
---------------
echo 100-99.6;
echo "<br>";
echo 100-99.96;
echo "<br>";
echo 1000-999.96;
Expected result:
----------------
0.4
0.04
0.04
Actual result:
--------------
0.40000000000001
0.040000000000006
0.039999999999964
--
Edit bug report at https://bugs.php.net/bug.php?id=72487&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72487&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72487&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72487&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72487&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72487&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72487&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72487&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72487&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72487&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72487&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72487&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72487&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72487&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72487&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72487&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72487&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72487&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72487&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72487&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72487&r=mysqlcfg