SQLite

Check-in [2349ae75df]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Back out check-in (5108). The original isnan() implementation is preferred. Ticket #3101 and #3060. (CVS 5109)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2349ae75dfdd626ed97db99ac6de4bdc5a395008
User & Date: drh 2008-05-09 13:47:59.000
Context
2008-05-09
14:17
Fix the ALTER TABLE RENAME algorithm so that it is not confused by comments in the CREATE TABLE statement. Ticket #3102. (CVS 5110) (check-in: ab18b4e759 user: drh tags: trunk)
13:47
Back out check-in (5108). The original isnan() implementation is preferred. Ticket #3101 and #3060. (CVS 5109) (check-in: 2349ae75df user: drh tags: trunk)
03:07
Change the implementation of sqlite3IsNaN() so that it works even if compiled using -ffinite-math-only. Tickets #3101 and #3060. (CVS 5108) (check-in: 19ee2b3324 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/util.c.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
**
*************************************************************************
** Utility functions used throughout sqlite.
**
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.226 2008/05/09 03:07:34 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
#include <ctype.h>


/*
** 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);
}

/*
** Set the most recent error code and error string for the sqlite
** handle "db". The error code is set to "err_code".
**
** If it is not NULL, string zFormat specifies the format of the







|










|
|
>
>
>
>
>
>
>


<
<
<
<
<
<
<
<
<







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38









39
40
41
42
43
44
45
**
*************************************************************************
** Utility functions used throughout sqlite.
**
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.227 2008/05/09 13:47:59 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
#include <ctype.h>


/*
** Return true if the floating point value is Not a Number.
*/
int sqlite3IsNaN(double x){
  /* This NaN test sometimes fails if compiled on GCC with -ffast-math.
  ** On the other hand, the use of -ffast-math comes with the following
  ** warning:
  **
  **      This option [-ffast-math] should never be turned on by any
  **      -O option since it can result in incorrect output for programs
  **      which depend on an exact implementation of IEEE or ISO 
  **      rules/specifications for math functions.
  */
  volatile double y = x;
  return x!=y;









}

/*
** Set the most recent error code and error string for the sqlite
** handle "db". The error code is set to "err_code".
**
** If it is not NULL, string zFormat specifies the format of the