Bug #80286 [NEW]: Math operation with precision in php.ini
| From: | is dot malozemov at ya dot ru | Date: | Tue, 27 Oct 2020 08:00:40 +0000 |
| Subject: | Bug #80286 [NEW]: Math operation with precision in php.ini | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-229932@lists.php.net to get a copy of this message | ||
From: is dot malozemov at ya dot ru
Operating system: Linux Ubuntu 20.04 LTS
PHP version: 7.3.23
Package: *Math Functions
Bug Type: Bug
Bug description:Math operation with precision in php.ini
Description:
------------
Math operations ignores precision option in php.ini (php 7+);
Precision is works for PHP 5.
Test script:
---------------
<?php
$precision = 18;
while($precision--) {
ini_set('precision', $precision);
echo $precision.":".(342349.23 - 341765.07)."\n";
}
Expected result:
----------------
17:584.15999999997439
16:584.1599999999744
15:584.159999999974
14:584.15999999997
13:584.16
12:584.16
11:584.16
10:584.16
9:584.16
8:584.16
7:584.16
6:584.16
5:584.16
4:584.2
3:584
2:5.8E+2
1:6.0E+2
0:6.0E+2
Actual result:
--------------
17:5.8E+2
16:5.8E+2
15:5.8E+2
14:5.8E+2
13:5.8E+2
12:5.8E+2
11:5.8E+2
10:5.8E+2
9:5.8E+2
8:5.8E+2
7:5.8E+2
6:5.8E+2
5:5.8E+2
4:5.8E+2
3:5.8E+2
2:5.8E+2
1:5.8E+2
0:5.8E+2
--
Edit bug report at https://bugs.php.net/bug.php?id=80286&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80286&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80286&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80286&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80286&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80286&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80286&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80286&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80286&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80286&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80286&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80286&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80286&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80286&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80286&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80286&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80286&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80286&r=mysqlcfg