summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2008-04-12 03:11:56 +0000
committerdas <das@FreeBSD.org>2008-04-12 03:11:56 +0000
commit61773c1deacd8758a3c214a1b608e5184f5c7748 (patch)
treec10403aa0cc06a8243bc3d11e4dc711be1a9738e
parent244a0bcf48872d13bf9179d3a111603a24ce1b33 (diff)
downloadFreeBSD-src-61773c1deacd8758a3c214a1b608e5184f5c7748.zip
FreeBSD-src-61773c1deacd8758a3c214a1b608e5184f5c7748.tar.gz
Updates for changes in the way printf() handles hex floating point
numbers.
-rw-r--r--lib/libc/stdio/printf.39
-rw-r--r--tools/regression/lib/libc/stdio/test-printfloat.c10
2 files changed, 10 insertions, 9 deletions
diff --git a/lib/libc/stdio/printf.3 b/lib/libc/stdio/printf.3
index 84e6089..a126a64 100644
--- a/lib/libc/stdio/printf.3
+++ b/lib/libc/stdio/printf.3
@@ -549,13 +549,14 @@ to separate the mantissa and exponent.
Note that there may be multiple valid ways to represent floating-point
numbers in this hexadecimal format.
For example,
-.Li 0x3.24p+0 , 0x6.48p-1
+.Li 0x1.92p+1 , 0x3.24p+0 , 0x6.48p-1 ,
and
.Li 0xc.9p-2
are all equivalent.
-The format chosen depends on the internal representation of the
-number, but the implementation guarantees that the length of the
-mantissa will be minimized.
+.Fx 8.0
+and later always prints finite non-zero numbers using
+.Ql 1
+as the digit before the hexadecimal point.
Zeroes are always represented with a mantissa of 0 (preceded by a
.Ql -
if appropriate) and an exponent of
diff --git a/tools/regression/lib/libc/stdio/test-printfloat.c b/tools/regression/lib/libc/stdio/test-printfloat.c
index 3c979c0..e7740b4 100644
--- a/tools/regression/lib/libc/stdio/test-printfloat.c
+++ b/tools/regression/lib/libc/stdio/test-printfloat.c
@@ -256,9 +256,9 @@ main(int argc, char *argv[])
testfmt("0x1.2345p-1024", "%a", 0x1.2345p-1024);
#if (LDBL_MANT_DIG == 64) && !defined(__i386__)
- testfmt("0xc.90fdaa22168c234p-2", "%La", 0x3.243f6a8885a308dp0L);
- testfmt("0x8p-16448", "%La", 0x1p-16445L);
- testfmt("0x9.8765p-16384", "%La", 0x9.8765p-16384L);
+ testfmt("0x1.921fb54442d18468p+1", "%La", 0x3.243f6a8885a308dp0L);
+ testfmt("0x1p-16445", "%La", 0x1p-16445L);
+ testfmt("0x1.30ecap-16381", "%La", 0x9.8765p-16384L);
#elif (LDBL_MANT_DIG == 113)
testfmt("0x1.921fb54442d18469898cc51701b8p+1", "%La",
0x3.243f6a8885a308d313198a2e037p0L);
@@ -303,8 +303,8 @@ main(int argc, char *argv[])
testfmt("0x1.23456p+0", "%.5a", 0x1.23456789abcdep0);
testfmt("0x1.234568p+0", "%.6a", 0x1.23456789abcdep0);
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.00p-1029", "%.2a", 0x1.fffp-1030);
+ testfmt("0x1.00p-1026", "%.2a", 0xf.fffp-1030);
testfmt("0x1.83p+0", "%.2a", 1.51);
printf("ok 11 - printfloat\n");
OpenPOWER on IntegriCloud