aboutsummaryrefslogtreecommitdiff
path: root/stdio-common/tfformat.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-02-21 08:57:44 +0000
committerUlrich Drepper <drepper@redhat.com>2007-02-21 08:57:44 +0000
commit0f7769f736a22aa930bebe3aa4f9656b671072b5 (patch)
treeebc113e13a24df6bd8aeadf0515d5ddfb918fd76 /stdio-common/tfformat.c
parent4c02bf1adf285060e809ef5df8f796c8cf3fb04d (diff)
downloadglibc-0f7769f736a22aa930bebe3aa4f9656b671072b5.zip
glibc-0f7769f736a22aa930bebe3aa4f9656b671072b5.tar.gz
glibc-0f7769f736a22aa930bebe3aa4f9656b671072b5.tar.bz2
[BZ #4070]
2007-02-21 Ulrich Drepper <drepper@redhat.com> [BZ #4070] * stdio-common/printf_fp.c (___printf_fp): Handle a few more * stdio-common/tfformat.c (sprint_doubles): Some more tests. special cases.
Diffstat (limited to 'stdio-common/tfformat.c')
-rw-r--r--stdio-common/tfformat.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/stdio-common/tfformat.c b/stdio-common/tfformat.c
index ea7365b..0370834 100644
--- a/stdio-common/tfformat.c
+++ b/stdio-common/tfformat.c
@@ -4012,6 +4012,14 @@ sprint_double_type sprint_doubles[] =
{__LINE__, 16, "0x1.0p+4", "%.1a"},
{__LINE__, 16, "0x1.00000000000000000000p+4", "%.20a"},
{__LINE__, 4444.88888888, "4445", "%2.F"},
+ {__LINE__, 0.956, "1", "%.0g"},
+ {__LINE__, 1.0956, "1.", "%#.0g"},
+ {__LINE__, 0.956, "1.", "%#.0g"},
+ {__LINE__, 0.0956, "0.1", "%#.0g"},
+ {__LINE__, 0.00956, "0.01", "%#.0g"},
+ {__LINE__, 0.000956, "0.001", "%#.0g"},
+ {__LINE__, 0.000098, "0.0001", "%#.0g"},
+ {__LINE__, 0.0000996, "0.00010", "%#.2g"},
{0 }
@@ -4023,13 +4031,8 @@ sprint_double_type sprint_doubles[] =
int required_precision = 13;
-#if defined(__STDC__) || defined(__cplusplus)
static int
matches (register char *result, register const char *desired)
-#else
-int matches(result, desired)
- register char *result; register const char *desired;
-#endif
{
int digits_seen = 0;
for (;; result++, desired++) {
@@ -4080,7 +4083,7 @@ int main(int argc, char *argv[])
/* And one special test. */
{
- const char ref[] = "1.7763568394002504646778106689453125e-15";
+ static const char ref[] = "1.7763568394002504646778106689453125e-15";
int i;
d = 1.0;
for (i = 1; i < 50; ++i)