diff options
author | drh <drh@noemail.net> | 2008-05-09 03:07:33 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2008-05-09 03:07:33 +0000 |
commit | 47d22f6702983f20908f76006b447f336eefd7ca (patch) | |
tree | 2ca7434808e8cbf045f9dd69dd77aab726ea60d8 /src | |
parent | 06fb0400f4a129b72aca064fc21e3a1f5f2d8d07 (diff) | |
download | sqlite-47d22f6702983f20908f76006b447f336eefd7ca.tar.gz sqlite-47d22f6702983f20908f76006b447f336eefd7ca.zip |
Change the implementation of sqlite3IsNaN() so that it works even if
compiled using -ffinite-math-only. Tickets #3101 and #3060. (CVS 5108)
FossilOrigin-Name: 19ee2b3324461150d2c1600c67fe604114a1b69f
Diffstat (limited to 'src')
-rw-r--r-- | src/util.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c index 46dc5cb53..548c6d6fb 100644 --- a/src/util.c +++ b/src/util.c @@ -14,7 +14,7 @@ ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** -** $Id: util.c,v 1.225 2008/05/01 02:47:04 shane Exp $ +** $Id: util.c,v 1.226 2008/05/09 03:07:34 drh Exp $ */ #include "sqliteInt.h" #include <stdarg.h> @@ -25,8 +25,19 @@ ** Return true if the floating point value is Not a Number. */ int sqlite3IsNaN(double x){ +#if 0 + /* This reportedly fails when compiled with -ffinite-math-only */ volatile double y = x; return x!=y; +#endif + /* We have to look at bit patterns to accurately determine NaN. + ** See ticket #3101 and + ** https://mail.mozilla.org/pipermail/tamarin-devel/2008-February/000325.html + */ + sqlite3_uint64 y = *(sqlite3_uint64*)&x; + assert( sizeof(x)==sizeof(y) ); + y &= (((sqlite3_uint64)0x80000000)<<32)-1; + return y > (((sqlite3_uint64)0x7ff00000)<<32); } /* |