From: eb1024 at gmail dot com Operating system: Windows XP / Fedora / (Others?) PHP version: 4.4.7 PHP Bug Type: Strings related Bug description: number_format returns wrong values for big numbers
Description: ------------ Hello, I've used the number_format function to add a thousands separator to a very large number (the 1000th Fibonacci number), the thing is that after using the number_format function the number which originally was 43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875 becomes, 43466557686937454881639861284285048836044564808501085299792936936934507578446811952241727283693776165701110466238201810459653426841499747856972973922645842460198740218733277412586280377875508003628944833118208 (or better yet): 43 466 557 686 937 454 881 639 861 284 285 048 836 044 564 808 501 085 299 792 936 936 934 507 578 446 811 952 241 727 283 693 776 165 701 110 466 238 201 810 459 653 426 841 499 747 856 972 973 922 645 842 460 198 740 218 733 277 412 586 280 377 875 508 003 628 944 833 118 208 As you can see the difference is huge! I tried it under PHP 5.2.1 and PHP 4.4 under Windows XP and Fedora Core 6. More info @ http://www.alixaxel.com/wordpress/2007/05/19/php-math-library/ if you need it! Reproduce code: --------------- $fibonacci_1000 = '43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875'; echo number_format($fibonacci_1000, 0, '', ' '); Expected result: ---------------- 43 466 557 686 937 456 435 688 527 675 040 625 802 564 660 517 371 780 402 481 729 089 536 555 417 949 051 890 403 879 840 079 255 169 295 922 593 080 322 634 775 209 689 623 239 873 322 471 161 642 996 440 906 533 187 938 298 969 649 928 516 003 704 476 137 795 166 849 228 875 Actual result: -------------- 43 466 557 686 937 454 881 639 861 284 285 048 836 044 564 808 501 085 299 792 936 936 934 507 578 446 811 952 241 727 283 693 776 165 701 110 466 238 201 810 459 653 426 841 499 747 856 972 973 922 645 842 460 198 740 218 733 277 412 586 280 377 875 508 003 628 944 833 118 208 -- Edit bug report at http://bugs.php.net/?id=42276&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42276&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42276&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42276&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42276&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42276&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42276&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42276&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42276&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42276&r=support Expected behavior: http://bugs.php.net/fix.php?id=42276&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42276&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42276&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42276&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42276&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42276&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42276&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42276&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42276&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42276&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42276&r=mysqlcfg
