diff options
author | Douglas Priest <Douglas.Priest@Sun.COM> | 2008-12-15 18:26:28 -0800 |
---|---|---|
committer | Douglas Priest <Douglas.Priest@Sun.COM> | 2008-12-15 18:26:28 -0800 |
commit | 146fa2c51dd8aad1aeb44dbb7fbfdb17a7afc18c (patch) | |
tree | f1a4b79da80cab73e5929a6f7a971189460b3494 /usr/src/lib | |
parent | 22cc0e4546a86e916ddbd8e5a4bed0875afaa288 (diff) | |
download | illumos-gate-146fa2c51dd8aad1aeb44dbb7fbfdb17a7afc18c.tar.gz |
6773712 sparc: 1-digit hex fp base conversion of long double rounds incorrectly
6773719 x64: single_to_decimal base conversion functions incorrectly in nonstandard fp mode
6776367 printf should not zero-pad NaN or infinity values
Diffstat (limited to 'usr/src/lib')
-rw-r--r-- | usr/src/lib/libc/port/fp/aconvert.c | 8 | ||||
-rw-r--r-- | usr/src/lib/libc/port/fp/double_decim.c | 13 | ||||
-rw-r--r-- | usr/src/lib/libc/port/print/doprnt.c | 1 |
3 files changed, 10 insertions, 12 deletions
diff --git a/usr/src/lib/libc/port/fp/aconvert.c b/usr/src/lib/libc/port/fp/aconvert.c index 833615e1cf..e3e411cb68 100644 --- a/usr/src/lib/libc/port/fp/aconvert.c +++ b/usr/src/lib/libc/port/fp/aconvert.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "lint.h" #include "base_conversion.h" @@ -148,7 +146,7 @@ __qaconvert(long double *arg, int ndigits, int *exp, int *sign, char *buf) a.q = *arg; *sign = a.i[0] >> 31; - ha = a.i[0] & ~0x80000000; + ha = a.i[0] &= ~0x80000000; /* check for infinity or nan */ if (ha >= 0x7fff0000) { @@ -195,7 +193,7 @@ __qaconvert(long double *arg, int ndigits, int *exp, int *sign, char *buf) * integer arithmetic. Explicitly raise the inexact * exception if anything is rounded off. */ - a.i[0] &= 0xffff; + a.i[0] = (a.i[0] & 0xffff) | 0x10000; if (ndigits <= 5) { /* * i and b are the index and bit position in a.i[] @@ -253,7 +251,7 @@ __qaconvert(long double *arg, int ndigits, int *exp, int *sign, char *buf) a.i[i] += b; while (a.i[i] == 0) a.i[--i]++; - if (a.i[0] >= 0x10000) + if (a.i[0] >= 0x20000) (*exp)++; } } diff --git a/usr/src/lib/libc/port/fp/double_decim.c b/usr/src/lib/libc/port/fp/double_decim.c index 4ce29a4981..0e57584484 100644 --- a/usr/src/lib/libc/port/fp/double_decim.c +++ b/usr/src/lib/libc/port/fp/double_decim.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Conversion from binary to decimal floating point */ @@ -546,15 +544,16 @@ single_to_decimal(single *px, decimal_mode *pm, decimal_record *pd, *ps = 0; return; } else { -#if defined(__sparc) +#if defined(__sparc) || defined(__amd64) int i; pd->fpclass = fp_subnormal; /* - * On SPARC, simply converting *px to double - * can flush a subnormal value to zero when - * nonstandard mode is enabled, so we have - * to go through all this nonsense instead. + * On SPARC when nonstandard mode is enabled, + * or on x64 when FTZ mode is enabled, simply + * converting *px to double can flush a sub- + * normal value to zero, so we have to go + * through all this nonsense instead. */ i = *(int *)px; x = (double)(i & ~0x80000000); diff --git a/usr/src/lib/libc/port/print/doprnt.c b/usr/src/lib/libc/port/print/doprnt.c index bf4f410583..2ad59ab3e5 100644 --- a/usr/src/lib/libc/port/print/doprnt.c +++ b/usr/src/lib/libc/port/print/doprnt.c @@ -2087,6 +2087,7 @@ wide_S: } inf_nan = 0; inf_nan_mixed_case = 0; + flagword &= ~PADZERO; /* ignore 0 flag */ } /* Calculate number of padding blanks */ |