#36392 [Opn->Asn]: wrong number of decimal digits with %e specifier in sprintf
| From: | sniper@php.net | Date: | Tue, 11 Apr 2006 11:16:04 +0000 |
| Subject: | #36392 [Opn->Asn]: wrong number of decimal digits with %e specifier in sprintf | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-95589@lists.php.net to get a copy of this message | ||
ID: 36392
Updated by: sniper@php.net
Reported By: tomas_matousek at hotmail dot com
-Status: Open
+Status: Assigned
Bug Type: Strings related
Operating System: WinXP
PHP Version: 5.1.2
-Assigned To:
+Assigned To: helly
New Comment:
Marcus, this is your doing. :)
Previous Comments:
------------------------------------------------------------------------
[2006-02-14 19:15:07] tomas_matousek at hotmail dot com
Description:
------------
Format specifier %e (scientific number) in sprintf() function gives
results with wrong number of decimal digits and in one particular case
it gives a mess.
Reproduce code:
---------------
echo sprintf("%e\n", 1.123456789);
echo sprintf("%.10e\n", 1.123456789);
echo sprintf("%.0e\n", 1.123456789); // this gives a mess
echo sprintf("%.1e\n", 1.123456789);
echo sprintf("%5.1e\n", 1.123456789);
Expected result:
----------------
1.123457e+0
1.1234567890e+0
1e+0
1.1e+0
1.1e+0
Actual result:
--------------
1.12346e+0
1.123456789e+0
.0e+0123456789
1.e+0
1.e+0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36392&edit=1