From: Operating system: OSX PHP version: 5.3.9 Package: Math related Bug Type: Bug Bug description:money_format returning inconsistent results
Description: ------------ php -r '$a = 70687.465 + 8.930;$b = 70696.395;$c = 70687.464 + 8.936;printf("A: %s %s %.9f\n", $a, money_format("%.2n", $a), $a);printf("B: %s %s %.9f\n", $b, money_format("%.2n", $b), $b);printf("C: %s %s %.9f\n", $c, money_format("%.2n", $c), $c);' Output: A: 70696.395 70696.39 70696.395000000 B: 70696.395 70696.40 70696.395000000 C: 70696.4 70696.40 70696.400000000 Why is A not getting rounded up to 70696.40? Test script: --------------- php -r '$a = 70687.465 + 8.930;$b = 70696.395;$c = 70687.464 + 8.936;printf("A: %s %s %.9f\n", $a, money_format("%.2n", $a), $a);printf("B: %s %s %.9f\n", $b, money_format("%.2n", $b), $b);printf("C: %s %s %.9f\n", $c, money_format("%.2n", $c), $c);' Expected result: ---------------- A: 70696.395 70696.40 70696.395000000 B: 70696.395 70696.40 70696.395000000 C: 70696.4 70696.40 70696.400000000 Actual result: -------------- A: 70696.395 70696.39 70696.395000000 B: 70696.395 70696.40 70696.395000000 C: 70696.4 70696.40 70696.400000000 -- Edit bug report at https://bugs.php.net/bug.php?id=60892&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60892&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60892&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60892&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60892&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60892&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60892&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60892&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60892&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60892&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60892&r=support Expected behavior: https://bugs.php.net/fix.php?id=60892&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60892&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60892&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60892&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60892&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60892&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60892&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60892&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60892&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60892&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60892&r=mysqlcfg