ID:               25290
 Comment by:       jan at traum-projekt dot com
 Reported By:      oli_pla at hotmail dot com
 Status:           Bogus
 Bug Type:         Strings related
 Operating System: Windows 2000/XP
 PHP Version:      4.3.3
 New Comment:

I can reproduce this too:

Same system (XAMPP from Apachefriends.org, WinXP Pro) as powermieze.

$my = 814.54;
printf("MY %0.2f", $my);
echo "<br>";
echo number_format($my,2);

gives:
MY 804.54
814.54


Previous Comments:
------------------------------------------------------------------------

[2003-10-11 13:04:42] powermieze at web dot de

I also tried the test "[28 Aug 7:35am EDT] oli_pla at hotmail dot com"
and the same occurs:

Reproduce code: printf('%.2f',813.54);
Expected result: 813.54
Actual result: 803.54

Reproduce code:
$my = 814.54;
printf("MY %0.2f", $my);
Expected result: 814.54
Actual result: 804.54

Reproduce code:
$my = 813.54;
printf("MY %0.2f", $my);
Expected result: 813.54
Actual result: 803.54

I tested this on XP Professionel System - ApacheFriends XAMPP Version
0.9: Apache/2.0.47 (Win32) mod_ssl/2.0.47 OpenSSL/0.9.7b
PHP/4.3.3RC2-dev

------------------------------------------------------------------------

[2003-08-28 10:14:52] [EMAIL PROTECTED]

Maybe you're mixing some old dlls with news ones (PHP related). This
works just fine for me on XP.


------------------------------------------------------------------------

[2003-08-28 07:35:32] oli_pla at hotmail dot com

Description:
------------
For some particular values, printf('%.2f',$val) gives incorrect results
on Windows 2000 and XP. The behaviour is that a digit is one unit too
low. For instance, with 813.54, you get 803.54, and 349.61 becomes
348.61.

On Windows 98 or Linux, the problem doesn't appear.

I'm aware it may be a bug in Microsoft's C runtime, in which case it
wouldn't be a PHP problem. But it would be interesting to be sure...

Reproduce code:
---------------
printf('%.2f',813.54);

Expected result:
----------------
813.54

Actual result:
--------------
803.54


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=25290&edit=1

Reply via email to