Minor changes to sysdeps/ieee754/dbl-64/s_fma.c

"Stefan Kanthak" <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Organization Me, myself & IT
Message-ID <69363C01FACB4BCBA94F3A892EFE8ADE@H270>
Hi @ll,

I propose the following minor changes to sysdeps/ieee754/dbl-64/s_fma.c:

1. replace

-  if ((u & 0x10000000) == 0
-     && ((u >> MANTISSA_WIDTH) & 0x7ff) > EXPONENT_BIAS - 126)

   with

+#define DOUBLE_EXPONENT_MASK (DOUBLE_EXPONENT_BIAS * 2 + 1)
+
+  if ((u & (1u << DOUBLE_MANTISSA_WIDTH - FLOAT_MANTISSA_WIDTH - 1)) == 0
+      && ((u >> DOUBLE_MANTISSA_WIDTH) & DOUBLE_EXPONENT_MASK) > DOUBLE_EXPONENT_BIAS - FLOAT_EXPONENT_BIAS)

   to better show where 0x10000000, 0x7ff and 126 originate from.

2. correct the spelling of 'double-rouding'

3. replace

-int neg = u >> 63;

   with

+int neg = (int64_t) u < 0;

4. replace

-  if (neg == (err < 0))
-    u++;
-  else
-    u--;

   with

+  u += (neg == (err < 0)) * 2 - 1;


Stefan Kanthak
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.