[PATCH] *printf %e bug (36392)
| From: | Matt Wilmas | Date: | Fri, 22 Dec 2006 12:20:20 +0000 |
| Subject: | [PATCH] *printf %e bug (36392) | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-27177@lists.php.net to get a copy of this message | ||
Hi,
Using the %e format specifier in the *printf() functions gives one less
decimal place than it should. The recent *printf changes only happened to
fix the problem when precision is 0. The new %E works correctly, which is
obvious from the code. :-) Anyway, the attached patches remove the few
problem lines.
BTW, should there be a NEWS entry about the addition of %g, %G, and the
previously missing %E (uppercase)? If I wasn't following the changes,
that's something I'd want to see... :-)
Matt
Index: ext/standard/formatted_print.c =================================================================== RCS file: /repository/php-src/ext/standard/formatted_print.c,v retrieving revision 1.93 diff -u -r1.93 formatted_print.c --- ext/standard/formatted_print.c 20 Dec 2006 18:33:27 -0000 1.93 +++ ext/standard/formatted_print.c 22 Dec 2006 11:55:29 -0000 @@ -368,9 +368,6 @@ switch (fmt) { case 'e': - if (precision) { - precision--; - } case 'E': case 'f': case 'F': @@ -485,9 +482,6 @@ switch (fmt) { case 0x65 /* 'e' */: - if (precision) { - precision--; - } case 0x45 /* 'E' */: case 0x46 /* 'F' */: case 0x66 /* 'f' */: Index: ext/standard/formatted_print.c =================================================================== RCS file: /repository/php-src/ext/standard/formatted_print.c,v retrieving revision 1.82.2.1.2.9 diff -u -r1.82.2.1.2.9 formatted_print.c --- ext/standard/formatted_print.c 19 Dec 2006 13:13:29 -0000 1.82.2.1.2.9 +++ ext/standard/formatted_print.c 22 Dec 2006 11:55:29 -0000 @@ -229,9 +229,6 @@ switch (fmt) { case 'e': - if (precision) { - precision--; - } case 'E': case 'f': case 'F':
Index: ext/standard/formatted_print.c =================================================================== RCS file: /repository/php-src/ext/standard/formatted_print.c,v retrieving revision 1.93 diff -u -r1.93 formatted_print.c --- ext/standard/formatted_print.c 20 Dec 2006 18:33:27 -0000 1.93 +++ ext/standard/formatted_print.c 22 Dec 2006 11:55:29 -0000 @@ -368,9 +368,6 @@ switch (fmt) { case 'e': - if (precision) { - precision--; - } case 'E': case 'f': case 'F': @@ -485,9 +482,6 @@ switch (fmt) { case 0x65 /* 'e' */: - if (precision) { - precision--; - } case 0x45 /* 'E' */: case 0x46 /* 'F' */: case 0x66 /* 'f' */: Index: ext/standard/formatted_print.c =================================================================== RCS file: /repository/php-src/ext/standard/formatted_print.c,v retrieving revision 1.82.2.1.2.9 diff -u -r1.82.2.1.2.9 formatted_print.c --- ext/standard/formatted_print.c 19 Dec 2006 13:13:29 -0000 1.82.2.1.2.9 +++ ext/standard/formatted_print.c 22 Dec 2006 11:55:29 -0000 @@ -229,9 +229,6 @@ switch (fmt) { case 'e': - if (precision) { - precision--; - } case 'E': case 'f': case 'F':