Bug #70316 [NEW]: round function bug
| From: | 277460173 at qq dot com | Date: | Fri, 21 Aug 2015 05:32:03 +0000 |
| Subject: | Bug #70316 [NEW]: round function bug | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-195383@lists.php.net to get a copy of this message | ||
From: 277460173 at qq dot com
Operating system: linux nginx PHP/5.4.41
PHP version: 5.4Git-2015-08-21 (Git)
Package: *General Issues
Bug Type: Bug
Bug description:round function bug
Description:
------------
$source=1370.72;
$local=1238.265;
$aa=($source - $local) / $source;
dump($aa);
$bb= round($aa,4);
dump($bb);
dump(phpversion());
result:
float(0.09663169721022523)
float(0.09660000000000001)
string(6) "5.4.41"
Test script:
---------------
$source=1370.72;
$local=1238.265;
$aa=($source - $local) / $source;
dump($aa);
$bb= round($aa,4);
dump($bb);
dump(phpversion());
Expected result:
----------------
float(0.09663169721022523)
float(0.0966)
string(6) "5.4.41"
Actual result:
--------------
float(0.09663169721022523)
float(0.09660000000000001)
string(6) "5.4.41"
--
Edit bug report at https://bugs.php.net/bug.php?id=70316&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70316&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70316&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70316&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70316&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70316&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70316&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70316&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70316&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70316&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70316&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70316&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70316&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70316&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70316&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70316&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70316&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70316&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70316&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70316&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70316&r=mysqlcfg