diff options
author | das <das@FreeBSD.org> | 2007-12-16 21:14:33 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2007-12-16 21:14:33 +0000 |
commit | 70cdf6a57447192c3b77090ed112c732882f95f3 (patch) | |
tree | 5f9e7a4fd4b4e74b456608617e283e71285fad2f /contrib/gdtoa/strtorQ.c | |
parent | b2367c2d0b77fb617f31b9fafae0c52dc8ecf89e (diff) | |
download | FreeBSD-src-70cdf6a57447192c3b77090ed112c732882f95f3.zip FreeBSD-src-70cdf6a57447192c3b77090ed112c732882f95f3.tar.gz |
Fix strto{f,d,ld}() so they don't return signaling NaNs. C99
says they are never supposed to, and the fact that they did could
cause apps that run with unmasked FP exceptions to SIGFPE after a
scanf() or strtod(). The vendor stated that he will not be fixing
this, citing portability concerns.
Diffstat (limited to 'contrib/gdtoa/strtorQ.c')
-rw-r--r-- | contrib/gdtoa/strtorQ.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/gdtoa/strtorQ.c b/contrib/gdtoa/strtorQ.c index a9a07da..b7f9bba 100644 --- a/contrib/gdtoa/strtorQ.c +++ b/contrib/gdtoa/strtorQ.c @@ -29,6 +29,8 @@ THIS SOFTWARE. /* Please send bug reports to David M. Gay (dmg at acm dot org, * with " at " changed at "@" and " dot " changed to "."). */ +/* $FreeBSD$ */ + #include "gdtoaimp.h" #undef _0 @@ -67,7 +69,8 @@ ULtoQ(ULong *L, ULong *bits, Long exp, int k) L[_3] = bits[0]; L[_2] = bits[1]; L[_1] = bits[2]; - L[_0] = (bits[3] & ~0x10000) | ((exp + 0x3fff + 112) << 16); + L[_0] = (bits[3] & ~0x10000) + | (((exp + 0x3fff + 112) << 16) | (1 << 15)); break; case STRTOG_Denormal: |