Bug #78408 [NEW]: Floating point rounding error

From: Date: Tue, 13 Aug 2019 08:32:39 +0000
Subject: Bug #78408 [NEW]: Floating point rounding error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222214@lists.php.net to get a copy of this message
From: djurredenboer at gmail dot com Operating system: Linux and Mac PHP version: 7.3.8 Package: Math related Bug Type: Bug Bug description:Floating point rounding error Description: ------------ If you add up 0.30 and 0.15 it and then cast to integer it will end up in 44 instead of 45 Test script: --------------- <?php $test = 0.30 + 0.15; $test2 = ((int)(100 * $test)); echo $test2; Expected result: ---------------- 45 Actual result: -------------- 44 -- Edit bug report at https://bugs.php.net/bug.php?id=78408&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78408&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78408&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78408&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78408&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78408&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78408&r=support Expected behavior: https://bugs.php.net/fix.php?id=78408&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78408&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78408&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78408&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78408&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78408&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78408&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78408&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78408&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78408&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78408&r=mysqlcfg

« previous php.bugs (#222214) next »