* stdio-common/printf_fp.c (___printf_fp): Fix exponent -4

special case handling when wcp == wstartp + 1.  Fix a comment typo.
	* stdio-common/tfformat.c (sprint_doubles): Add a new testcase.
This commit is contained in:
Ulrich Drepper 2007-04-16 23:28:39 +00:00
parent 0fca3153e7
commit d40e67f54c
3 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2007-04-13 Jakub Jelinek <jakub@redhat.com>
* stdio-common/printf_fp.c (___printf_fp): Fix exponent -4
special case handling when wcp == wstartp + 1. Fix a comment typo.
* stdio-common/tfformat.c (sprint_doubles): Add a new testcase.
2007-03-30 Jakub Jelinek <jakub@redhat.com> 2007-03-30 Jakub Jelinek <jakub@redhat.com>
* libio/libio.h (__underflow, __uflow, __overflow, __wunderflow, * libio/libio.h (__underflow, __uflow, __overflow, __wunderflow,

View File

@ -990,7 +990,7 @@ ___printf_fp (FILE *fp,
0)) 0))
/* This is a special case: the rounded number is 1.0, /* This is a special case: the rounded number is 1.0,
the format is 'g' or 'G', and the alternative format the format is 'g' or 'G', and the alternative format
is selected. This means the result mist be "1.". */ is selected. This means the result must be "1.". */
--added_zeros; --added_zeros;
} }
@ -1081,13 +1081,18 @@ ___printf_fp (FILE *fp,
/* This is another special case. The exponent of the number is /* This is another special case. The exponent of the number is
really smaller than -4, which requires the 'e'/'E' format. really smaller than -4, which requires the 'e'/'E' format.
But after rounding the number has an exponent of -4. */ But after rounding the number has an exponent of -4. */
assert (wcp >= wstartp + 2); assert (wcp >= wstartp + 1);
assert (wstartp[0] == L'1'); assert (wstartp[0] == L'1');
__wmemcpy (wstartp, L"0.0001", 6); __wmemcpy (wstartp, L"0.0001", 6);
wstartp[1] = decimalwc; wstartp[1] = decimalwc;
if (wcp >= wstartp + 2)
{
wmemset (wstartp + 6, L'0', wcp - (wstartp + 2)); wmemset (wstartp + 6, L'0', wcp - (wstartp + 2));
wcp += 4; wcp += 4;
} }
else
wcp += 5;
}
else else
{ {
*wcp++ = (wchar_t) type; *wcp++ = (wchar_t) type;

View File

@ -4020,6 +4020,7 @@ sprint_double_type sprint_doubles[] =
{__LINE__, 0.000956, "0.001", "%#.0g"}, {__LINE__, 0.000956, "0.001", "%#.0g"},
{__LINE__, 0.000098, "0.0001", "%#.0g"}, {__LINE__, 0.000098, "0.0001", "%#.0g"},
{__LINE__, 0.0000996, "0.00010", "%#.2g"}, {__LINE__, 0.0000996, "0.00010", "%#.2g"},
{__LINE__, 9.999999999999999e-05, "0.0001", "%g"},
{0 } {0 }