summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2007-12-03 07:18:47 +0000
committerdas <das@FreeBSD.org>2007-12-03 07:18:47 +0000
commit994e05ec27c99819b23bc60069a2eab69cee3838 (patch)
tree73723d5748fa0dcc85a892b6a593e777d91d9b61 /tools
parent3f2a2dba4d4736a24fc3d2d5b0fc88cb2366e371 (diff)
downloadFreeBSD-src-994e05ec27c99819b23bc60069a2eab69cee3838.zip
FreeBSD-src-994e05ec27c99819b23bc60069a2eab69cee3838.tar.gz
Tests for rounding, and for the leading 0's bug.
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/lib/libc/stdio/test-printfloat.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/regression/lib/libc/stdio/test-printfloat.c b/tools/regression/lib/libc/stdio/test-printfloat.c
index fcacee5..5717a15 100644
--- a/tools/regression/lib/libc/stdio/test-printfloat.c
+++ b/tools/regression/lib/libc/stdio/test-printfloat.c
@@ -91,12 +91,15 @@ main(int argc, char *argv[])
testfmt("NAN", "%F", NAN);
testfmt("nan", "%g", NAN);
testfmt("NAN", "%LE", (long double)NAN);
+ testfmt(" nan", "%05e", NAN);
testfmt("INF", "%E", HUGE_VAL);
testfmt("-inf", "%f", -HUGE_VAL);
testfmt("+inf", "%+g", HUGE_VAL);
testfmt(" inf", "%4.2Le", HUGE_VALL);
testfmt("-inf", "%Lf", -HUGE_VALL);
+ testfmt(" inf", "%05e", HUGE_VAL);
+ testfmt(" -inf", "%05e", -HUGE_VAL);
printf("ok 2 - printfloat\n");
@@ -210,18 +213,26 @@ main(int argc, char *argv[])
fesetround(FE_DOWNWARD);
testfmt("4.437", "%.3f", 4.4375);
testfmt("-4.438", "%.3f", -4.4375);
+ testfmt("4.437", "%.3Lf", 4.4375L);
+ testfmt("-4.438", "%.3Lf", -4.4375L);
fesetround(FE_UPWARD);
testfmt("4.438", "%.3f", 4.4375);
testfmt("-4.437", "%.3f", -4.4375);
+ testfmt("4.438", "%.3Lf", 4.4375L);
+ testfmt("-4.437", "%.3Lf", -4.4375L);
fesetround(FE_TOWARDZERO);
testfmt("4.437", "%.3f", 4.4375);
testfmt("-4.437", "%.3f", -4.4375);
+ testfmt("4.437", "%.3Lf", 4.4375L);
+ testfmt("-4.437", "%.3Lf", -4.4375L);
fesetround(FE_TONEAREST);
testfmt("4.438", "%.3f", 4.4375);
testfmt("-4.438", "%.3f", -4.4375);
+ testfmt("4.438", "%.3Lf", 4.4375L);
+ testfmt("-4.438", "%.3Lf", -4.4375L);
printf("ok 9 - printfloat\n");
@@ -291,9 +302,10 @@ main(int argc, char *argv[])
testfmt("-0x1.23456p+0", "%.5a", -0x1.23456789abcdep0);
testfmt("0x1.23456p+0", "%.5a", 0x1.23456789abcdep0);
testfmt("0x1.234568p+0", "%.6a", 0x1.23456789abcdep0);
- testfmt("-0x1.234566p+0", "%.6a", -0x1.23456689abcdep0);
+ testfmt("-0x1.234567p+0", "%.6a", -0x1.23456689abcdep0);
testfmt("0x2.00p-1030", "%.2a", 0x1.fffp-1030);
testfmt("0x2.00p-1027", "%.2a", 0xf.fffp-1030);
+ testfmt("0x1.83p+0", "%.2a", 1.51);
printf("ok 11 - printfloat\n");
OpenPOWER on IntegriCloud