summaryrefslogtreecommitdiffstats
path: root/contrib/gdtoa/strtorx.c
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2007-01-03 04:58:54 +0000
committerdas <das@FreeBSD.org>2007-01-03 04:58:54 +0000
commit5bc737f35262327ca86ef96a7cbc6680c8eeb2ea (patch)
tree5f657cd7247cc76d6a32a0ea1f51ec09f8b25661 /contrib/gdtoa/strtorx.c
parent2b54587e529691da13ad420858ce167f84023ce5 (diff)
downloadFreeBSD-src-5bc737f35262327ca86ef96a7cbc6680c8eeb2ea.zip
FreeBSD-src-5bc737f35262327ca86ef96a7cbc6680c8eeb2ea.tar.gz
Import of the latest gdtoa sources, which include fixes for minor
problems relating to NaNs and rounding.
Diffstat (limited to 'contrib/gdtoa/strtorx.c')
-rw-r--r--contrib/gdtoa/strtorx.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/contrib/gdtoa/strtorx.c b/contrib/gdtoa/strtorx.c
index 0a81e95..23f721a 100644
--- a/contrib/gdtoa/strtorx.c
+++ b/contrib/gdtoa/strtorx.c
@@ -26,14 +26,8 @@ THIS SOFTWARE.
****************************************************************/
-/* Please send bug reports to
- David M. Gay
- Bell Laboratories, Room 2C-463
- 600 Mountain Avenue
- Murray Hill, NJ 07974-0636
- U.S.A.
- dmg@bell-labs.com
- */
+/* Please send bug reports to David M. Gay (dmg at acm dot org,
+ * with " at " changed at "@" and " dot " changed to "."). */
#include "gdtoaimp.h"
@@ -70,14 +64,18 @@ ULtox(UShort *L, ULong *bits, Long exp, int k)
L[0] = L[1] = L[2] = L[3] = L[4] = 0;
break;
- case STRTOG_Normal:
case STRTOG_Denormal:
+ L[_0] = 0;
+ goto normal_bits;
+
+ case STRTOG_Normal:
case STRTOG_NaNbits:
+ L[_0] = exp + 0x3fff + 63;
+ normal_bits:
L[_4] = (UShort)bits[0];
L[_3] = (UShort)(bits[0] >> 16);
L[_2] = (UShort)bits[1];
L[_1] = (UShort)(bits[1] >> 16);
- L[_0] = exp + 0x3fff + 63;
break;
case STRTOG_Infinite:
@@ -86,8 +84,11 @@ ULtox(UShort *L, ULong *bits, Long exp, int k)
break;
case STRTOG_NaN:
- L[_0] = 0x7fff;
- L[_1] = L[_2] = L[_3] = L[_4] = (UShort)-1;
+ L[0] = ldus_QNAN0;
+ L[1] = ldus_QNAN1;
+ L[2] = ldus_QNAN2;
+ L[3] = ldus_QNAN3;
+ L[4] = ldus_QNAN4;
}
if (k & STRTOG_Neg)
L[_0] |= 0x8000;
OpenPOWER on IntegriCloud