#42831 [Opn]: function number_format() seems to return a wrong value

From: Date: Thu, 11 Oct 2007 00:30:24 +0000
Subject: #42831 [Opn]: function number_format() seems to return a wrong value
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-118376@lists.php.net to get a copy of this message
ID: 42831 Updated by: ab5602@php.net -Summary: function number_format() seems to return a wrong balue Reported By: naweokawa at free dot fr Status: Open Bug Type: Strings related Operating System: Solaris 10 PHP Version: 5.2.4 -Assigned To: +Assigned To: ab5602 New Comment: Hi, I cannot reproduce either. $ uname -a SunOS opteron 5.10 Generic_118855-14 i86pc i386 i86pc $ isainfo -v 64-bit amd64 applications sse3 sse2 sse fxsr amd_3dnowx amd_3dnow amd_mmx mmx cmov amd_sysc cx8 tsc fpu 32-bit i386 applications sse3 sse2 sse fxsr amd_3dnowx amd_3dnow amd_mmx mmx cmov amd_sysc cx8 tsc fpu $ ./php -v PHP 5.2.5-dev (cli) (built: Oct 10 2007 19:51:01) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies $ cat ./num.php <? $num2=123456.55; echo number_format($num2 , 2, ',', ' '); ?> $ ./php ./num.php 123 456,55 Previous Comments: ------------------------------------------------------------------------ [2007-10-03 21:00:15] naweokawa at free dot fr This issue doesn't seems appear on Solaris 10 x86 32 bits. But it persits on Solaris 10 / AMD64 compiled on full 64bits. ------------------------------------------------------------------------ [2007-10-03 10:56:34] tony2001@php.net GCC 3.4.3 is quite old and is known to have problems on SPARC. Try with something newer (the latest available would be great). ------------------------------------------------------------------------ [2007-10-03 10:25:16] naweokawa at free dot fr Always same issue with (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath) ------------------------------------------------------------------------ [2007-10-03 09:47:27] tony2001@php.net Try compiling with GCC. ------------------------------------------------------------------------ [2007-10-03 09:13:18] naweokawa at free dot fr it seems to run correctly on Linux (tested on Linux xxx 2.6.8-2-386 #1 Tue Aug 16 12:46:35 UTC 2005 i686 GNU/Linux) Reproduce code: --------------- $num2=123456.55; echo number_format($num2 , 2, ',', ' '); echo "<br />\n"; echo number_format($num2 , 3, ',', ' '); // OUTPUT 123 456,55 (OK) 123 456,550 (OK) However on Solaris10 (SunOS xxx 5.10 Generic_118855-33 i86pc i386 i86pc) Reproduce code: --------------- $num2=123456.55; echo number_format($num2 , 2, ',', ' '); echo "<br />\n"; echo number_format($num2 , 3, ',', ' '); // OUTPUT 12 345 655,00 (KO) 123 456 550,000 (KO) - The Locale settings shouldn't used for this function ? - php-5.2.4 compiled with cc: Sun C 5.8 2005/10/13 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/42831 -- Edit this bug report at http://bugs.php.net/?id=42831&edit=1

« previous php.bugs (#118376) next »