diff options
| -rw-r--r-- | lib/libc/stdio/printf.3 | 9 | ||||
| -rw-r--r-- | tools/regression/lib/libc/stdio/test-printfloat.c | 10 |
2 files changed, 10 insertions, 9 deletions
diff --git a/lib/libc/stdio/printf.3 b/lib/libc/stdio/printf.3 index 84e6089b6b7c..a126a641fc3d 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 3c979c0424ba..e7740b409557 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"); |
