php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25290 printf produces incorrect result
Submitted: 2003-08-28 07:35 UTC Modified: 2003-08-28 10:14 UTC
From: oli_pla at hotmail dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.3 OS: Windows 2000/XP
Private report: No CVE-ID: None
 [2003-08-28 07:35 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-28 10:14 UTC] sniper@php.net
Maybe you're mixing some old dlls with news ones (PHP related). This works just fine for me on XP.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC