Updates for changes in the way printf() handles hex floating point
numbers.
This commit is contained in:
parent
76303a9735
commit
e058c00c40
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=178141
@ -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
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user