Bug #81285 [NEW]: Division of floats results strange values
| From: | rico dot humme at gmail dot com | Date: | Fri, 23 Jul 2021 13:51:19 +0000 |
| Subject: | Bug #81285 [NEW]: Division of floats results strange values | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-235309@lists.php.net to get a copy of this message | ||
From: rico dot humme at gmail dot com
Operating system: Ubuntu
PHP version: 8.0.8
Package: Math related
Bug Type: Bug
Bug description:Division of floats results strange values
Description:
------------
I've come across this as trying to find a workaround for fmod()
Calculations:
9.6 / 3.2
9.9 / 3.3
Results:
Before PHP 8:
float(3)
float(3)
PHP 8+:
float(2.9999999999999996)
float(3.0000000000000004)
Test script:
---------------
Test script for testing on multiple versions:
https://3v4l.org/9bRl5
Expected result:
----------------
Result should return float(3) on all versions
--
Edit bug report at https://bugs.php.net/bug.php?id=81285&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81285&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81285&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81285&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81285&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81285&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81285&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81285&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81285&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81285&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81285&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81285&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81285&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81285&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81285&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81285&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81285&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81285&r=mysqlcfg