Created
July 12, 2016 13:45
-
-
Save brody4hire/bf1797a9d4d967c256f20d0bde7a398c to your computer and use it in GitHub Desktop.
Proposal: fix SQLITE_OMIT_FLOATING_POINT for SQLite 77c692a6 (trunk)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If I build SQLite 77c692a6 (trunk) with CFLAGS="-DSQLITE_OMIT_FLOATING_POINT" | |
I get a bunch of errors. Here is a patch in 3 parts that would fix this issue: | |
* SQLite-77c692a6-double-fix-part-1.diff - fix sqlite.h.in to use a proper | |
typedef to define a new sqlite_double typedef instead of using a macro | |
to overwrite double | |
* SQLite-77c692a6-double-fix-part-2.diff - fix other headers to use | |
the new sqlite_double typedef instead of double | |
* SQLite-77c692a6-double-fix-part-3.diff - fix src/*.c to use the new | |
sqlite_double typedef instead of double | |
OMITTED: | |
* src/date.c - I would like to see this source fixed to use larger integer | |
values instead of double-precision floating point values. | |
* R-Tree and other extensions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- src/sqlite.h.in | |
+++ src/sqlite.h.in | |
@@ -263,11 +263,13 @@ | |
/* | |
** If compiling for a processor that lacks floating point support, | |
** substitute integer for floating-point. | |
*/ | |
#ifdef SQLITE_OMIT_FLOATING_POINT | |
-# define double sqlite3_int64 | |
+ typedef sqlite_int64 sqlite_double; | |
+#else | |
+ typedef double sqlite_double; | |
#endif | |
/* | |
** CAPI3REF: Closing A Database Connection | |
** DESTRUCTOR: sqlite3 | |
@@ -1211,11 +1213,11 @@ | |
void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg); | |
void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void); | |
void (*xDlClose)(sqlite3_vfs*, void*); | |
int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut); | |
int (*xSleep)(sqlite3_vfs*, int microseconds); | |
- int (*xCurrentTime)(sqlite3_vfs*, double*); | |
+ int (*xCurrentTime)(sqlite3_vfs*, sqlite_double*); | |
int (*xGetLastError)(sqlite3_vfs*, int, char *); | |
/* | |
** The methods above are in version 1 of the sqlite_vfs object | |
** definition. Those that follow are added in version 2 or later | |
*/ | |
@@ -3624,11 +3626,11 @@ | |
** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()]. | |
*/ | |
int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*)); | |
int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64, | |
void(*)(void*)); | |
-int sqlite3_bind_double(sqlite3_stmt*, int, double); | |
+int sqlite3_bind_double(sqlite3_stmt*, int, sqlite_double); | |
int sqlite3_bind_int(sqlite3_stmt*, int, int); | |
int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64); | |
int sqlite3_bind_null(sqlite3_stmt*, int); | |
int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*)); | |
int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*)); | |
@@ -4132,11 +4134,11 @@ | |
** [SQLITE_NOMEM].)^ | |
*/ | |
const void *sqlite3_column_blob(sqlite3_stmt*, int iCol); | |
int sqlite3_column_bytes(sqlite3_stmt*, int iCol); | |
int sqlite3_column_bytes16(sqlite3_stmt*, int iCol); | |
-double sqlite3_column_double(sqlite3_stmt*, int iCol); | |
+sqlite_double sqlite3_column_double(sqlite3_stmt*, int iCol); | |
int sqlite3_column_int(sqlite3_stmt*, int iCol); | |
sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol); | |
const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol); | |
const void *sqlite3_column_text16(sqlite3_stmt*, int iCol); | |
int sqlite3_column_type(sqlite3_stmt*, int iCol); | |
@@ -4417,11 +4419,11 @@ | |
** the SQL function that supplied the [sqlite3_value*] parameters. | |
*/ | |
const void *sqlite3_value_blob(sqlite3_value*); | |
int sqlite3_value_bytes(sqlite3_value*); | |
int sqlite3_value_bytes16(sqlite3_value*); | |
-double sqlite3_value_double(sqlite3_value*); | |
+sqlite_double sqlite3_value_double(sqlite3_value*); | |
int sqlite3_value_int(sqlite3_value*); | |
sqlite3_int64 sqlite3_value_int64(sqlite3_value*); | |
const unsigned char *sqlite3_value_text(sqlite3_value*); | |
const void *sqlite3_value_text16(sqlite3_value*); | |
const void *sqlite3_value_text16le(sqlite3_value*); | |
@@ -4723,11 +4725,11 @@ | |
** the [sqlite3_context] pointer, the results are undefined. | |
*/ | |
void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*)); | |
void sqlite3_result_blob64(sqlite3_context*,const void*, | |
sqlite3_uint64,void(*)(void*)); | |
-void sqlite3_result_double(sqlite3_context*, double); | |
+void sqlite3_result_double(sqlite3_context*, sqlite_double); | |
void sqlite3_result_error(sqlite3_context*, const char*, int); | |
void sqlite3_result_error16(sqlite3_context*, const void*, int); | |
void sqlite3_result_error_toobig(sqlite3_context*); | |
void sqlite3_result_error_nomem(sqlite3_context*); | |
void sqlite3_result_error_code(sqlite3_context*, int); | |
@@ -5782,11 +5784,11 @@ | |
} *aConstraintUsage; | |
int idxNum; /* Number used to identify the index */ | |
char *idxStr; /* String, possibly obtained from sqlite3_malloc */ | |
int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */ | |
int orderByConsumed; /* True if output is already ordered */ | |
- double estimatedCost; /* Estimated cost of using this index */ | |
+ sqlite_double estimatedCost; /* Estimated cost of using this index */ | |
/* Fields below are only available in SQLite 3.8.2 and later */ | |
sqlite3_int64 estimatedRows; /* Estimated number of rows returned */ | |
/* Fields below are only available in SQLite 3.9.0 and later */ | |
int idxFlags; /* Mask of SQLITE_INDEX_SCAN_* flags */ | |
/* Fields below are only available in SQLite 3.10.0 and later */ | |
@@ -8205,17 +8207,9 @@ | |
SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp( | |
sqlite3_snapshot *p1, | |
sqlite3_snapshot *p2 | |
); | |
-/* | |
-** Undo the hack that converts floating point types to integer for | |
-** builds on processors without floating point support. | |
-*/ | |
-#ifdef SQLITE_OMIT_FLOATING_POINT | |
-# undef double | |
-#endif | |
- | |
#ifdef __cplusplus | |
} /* End of the 'extern "C"' block */ | |
#endif | |
#endif /* SQLITE3_H */ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- src/sqlite3ext.h | |
+++ src/sqlite3ext.h | |
@@ -33,11 +33,11 @@ | |
*/ | |
struct sqlite3_api_routines { | |
void * (*aggregate_context)(sqlite3_context*,int nBytes); | |
int (*aggregate_count)(sqlite3_context*); | |
int (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*)); | |
- int (*bind_double)(sqlite3_stmt*,int,double); | |
+ int (*bind_double)(sqlite3_stmt*,int,sqlite_double); | |
int (*bind_int)(sqlite3_stmt*,int,int); | |
int (*bind_int64)(sqlite3_stmt*,int,sqlite_int64); | |
int (*bind_null)(sqlite3_stmt*,int); | |
int (*bind_parameter_count)(sqlite3_stmt*); | |
int (*bind_parameter_index)(sqlite3_stmt*,const char*zName); | |
@@ -59,11 +59,11 @@ | |
int (*column_count)(sqlite3_stmt*pStmt); | |
const char * (*column_database_name)(sqlite3_stmt*,int); | |
const void * (*column_database_name16)(sqlite3_stmt*,int); | |
const char * (*column_decltype)(sqlite3_stmt*,int i); | |
const void * (*column_decltype16)(sqlite3_stmt*,int); | |
- double (*column_double)(sqlite3_stmt*,int iCol); | |
+ sqlite_double (*column_double)(sqlite3_stmt*,int iCol); | |
int (*column_int)(sqlite3_stmt*,int iCol); | |
sqlite_int64 (*column_int64)(sqlite3_stmt*,int iCol); | |
const char * (*column_name)(sqlite3_stmt*,int); | |
const void * (*column_name16)(sqlite3_stmt*,int); | |
const char * (*column_origin_name)(sqlite3_stmt*,int); | |
@@ -119,11 +119,11 @@ | |
void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*); | |
void (*progress_handler)(sqlite3*,int,int(*)(void*),void*); | |
void *(*realloc)(void*,int); | |
int (*reset)(sqlite3_stmt*pStmt); | |
void (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*)); | |
- void (*result_double)(sqlite3_context*,double); | |
+ void (*result_double)(sqlite3_context*,sqlite_double); | |
void (*result_error)(sqlite3_context*,const char*,int); | |
void (*result_error16)(sqlite3_context*,const void*,int); | |
void (*result_int)(sqlite3_context*,int); | |
void (*result_int64)(sqlite3_context*,sqlite_int64); | |
void (*result_null)(sqlite3_context*); | |
@@ -148,11 +148,11 @@ | |
sqlite_int64),void*); | |
void * (*user_data)(sqlite3_context*); | |
const void * (*value_blob)(sqlite3_value*); | |
int (*value_bytes)(sqlite3_value*); | |
int (*value_bytes16)(sqlite3_value*); | |
- double (*value_double)(sqlite3_value*); | |
+ sqlite_double (*value_double)(sqlite3_value*); | |
int (*value_int)(sqlite3_value*); | |
sqlite_int64 (*value_int64)(sqlite3_value*); | |
int (*value_numeric_type)(sqlite3_value*); | |
const unsigned char * (*value_text)(sqlite3_value*); | |
const void * (*value_text16)(sqlite3_value*); | |
--- src/sqliteInt.h | |
+++ src/sqliteInt.h | |
@@ -498,12 +498,10 @@ | |
/* | |
** If compiling for a processor that lacks floating point support, | |
** substitute integer for floating-point | |
*/ | |
#ifdef SQLITE_OMIT_FLOATING_POINT | |
-# define double sqlite_int64 | |
-# define float sqlite_int64 | |
# define LONGDOUBLE_TYPE sqlite_int64 | |
# ifndef SQLITE_BIG_DBL | |
# define SQLITE_BIG_DBL (((sqlite3_int64)1)<<50) | |
# endif | |
# define SQLITE_OMIT_DATETIME_FUNCS 1 | |
@@ -616,11 +614,11 @@ | |
#else | |
# define SQLITE_ASCII 1 | |
#endif | |
/* | |
-** Integers of known sizes. These typedefs might change for architectures | |
+** Numbers of known sizes. These typedefs might change for architectures | |
** where the sizes very. Preprocessor macros are available so that the | |
** types can be conveniently redefined at compile-type. Like this: | |
** | |
** cc '-DUINTPTR_TYPE=long long int' ... | |
*/ | |
@@ -667,10 +665,17 @@ | |
typedef UINT32_TYPE u32; /* 4-byte unsigned integer */ | |
typedef UINT16_TYPE u16; /* 2-byte unsigned integer */ | |
typedef INT16_TYPE i16; /* 2-byte signed integer */ | |
typedef UINT8_TYPE u8; /* 1-byte unsigned integer */ | |
typedef INT8_TYPE i8; /* 1-byte signed integer */ | |
+/* | |
+#ifdef SQLITE_OMIT_FLOATING_POINT | |
+ typedef sqlite_int64 sqlite_double; | |
+#else | |
+ typedef double sqlite_double; | |
+#endif | |
+*/ | |
/* | |
** SQLITE_MAX_U32 is a u64 constant that is the maximum u64 value | |
** that can be stored in a u32 without loss of data. The value | |
** is 0x00000000ffffffff. But because of quirks of some compilers, we | |
@@ -1315,11 +1320,11 @@ | |
void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*); | |
void *pCollNeededArg; | |
sqlite3_value *pErr; /* Most recent error message */ | |
union { | |
volatile int isInterrupted; /* True if sqlite3_interrupt has been called */ | |
- double notUsed1; /* Spacer */ | |
+ sqlite_double notUsed1; /* Spacer */ | |
} u1; | |
Lookaside lookaside; /* Lookaside malloc configuration */ | |
#ifndef SQLITE_OMIT_AUTHORIZATION | |
sqlite3_xauth xAuth; /* Access authorization function */ | |
void *pAuthArg; /* 1st argument to the access auth function */ | |
@@ -3459,11 +3464,11 @@ | |
/* Access to mutexes used by sqlite3_status() */ | |
sqlite3_mutex *sqlite3Pcache1Mutex(void); | |
sqlite3_mutex *sqlite3MallocMutex(void); | |
#ifndef SQLITE_OMIT_FLOATING_POINT | |
- int sqlite3IsNaN(double); | |
+ int sqlite3IsNaN(sqlite_double); | |
#else | |
# define sqlite3IsNaN(X) 0 | |
#endif | |
/* | |
@@ -3807,20 +3812,20 @@ | |
int sqlite3FixSrcList(DbFixer*, SrcList*); | |
int sqlite3FixSelect(DbFixer*, Select*); | |
int sqlite3FixExpr(DbFixer*, Expr*); | |
int sqlite3FixExprList(DbFixer*, ExprList*); | |
int sqlite3FixTriggerStep(DbFixer*, TriggerStep*); | |
-int sqlite3AtoF(const char *z, double*, int, u8); | |
+int sqlite3AtoF(const char *z, sqlite_double*, int, u8); | |
int sqlite3GetInt32(const char *, int*); | |
int sqlite3Atoi(const char*); | |
int sqlite3Utf16ByteLen(const void *pData, int nChar); | |
int sqlite3Utf8CharLen(const char *pData, int nByte); | |
u32 sqlite3Utf8Read(const u8**); | |
LogEst sqlite3LogEst(u64); | |
LogEst sqlite3LogEstAdd(LogEst,LogEst); | |
#ifndef SQLITE_OMIT_VIRTUALTABLE | |
-LogEst sqlite3LogEstFromDouble(double); | |
+LogEst sqlite3LogEstFromDouble(sqlite_double); | |
#endif | |
#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \ | |
defined(SQLITE_ENABLE_STAT3_OR_STAT4) || \ | |
defined(SQLITE_EXPLAIN_ESTIMATED_ROWS) | |
u64 sqlite3LogEstToInt(LogEst); | |
--- src/vdbe.h | |
+++ src/vdbe.h | |
@@ -49,11 +49,11 @@ | |
union p4union { /* fourth parameter */ | |
int i; /* Integer value if p4type==P4_INT32 */ | |
void *p; /* Generic pointer */ | |
char *z; /* Pointer to data for string (char array) types */ | |
i64 *pI64; /* Used when p4type is P4_INT64 */ | |
- double *pReal; /* Used when p4type is P4_REAL */ | |
+ sqlite_double *pReal; /* Used when p4type is P4_REAL */ | |
FuncDef *pFunc; /* Used when p4type is P4_FUNCDEF */ | |
sqlite3_context *pCtx; /* Used when p4type is P4_FUNCCTX */ | |
CollSeq *pColl; /* Used when p4type is P4_COLLSEQ */ | |
Mem *pMem; /* Used when p4type is P4_MEM */ | |
VTable *pVtab; /* Used when p4type is P4_VTAB */ | |
--- src/vdbeInt.h | |
+++ src/vdbeInt.h | |
@@ -16,10 +16,12 @@ | |
** this header information was factored out. | |
*/ | |
#ifndef SQLITE_VDBEINT_H | |
#define SQLITE_VDBEINT_H | |
+#include "sqliteInt.h" | |
+ | |
/* | |
** The maximum number of times that a statement will try to reparse | |
** itself before giving up and returning SQLITE_SCHEMA. | |
*/ | |
#ifndef SQLITE_MAX_SCHEMA_RETRY | |
@@ -185,11 +187,11 @@ | |
** structures. Each Mem struct may cache multiple representations (string, | |
** integer etc.) of the same value. | |
*/ | |
struct Mem { | |
union MemValue { | |
- double r; /* Real value used when MEM_Real is set in flags */ | |
+ sqlite_double r; /* Real value used when MEM_Real is set in flags */ | |
i64 i; /* Integer value used when MEM_Int is set in flags */ | |
int nZero; /* Used when bit MEM_Zero is set in flags */ | |
FuncDef *pDef; /* Used only when flags==MEM_Agg */ | |
RowSet *pRowSet; /* Used only when flags==MEM_RowSet */ | |
VdbeFrame *pFrame; /* Used when flags==MEM_Frame */ | |
@@ -480,21 +482,21 @@ | |
int sqlite3VdbeMemSetStr(Mem*, const char*, int, u8, void(*)(void*)); | |
void sqlite3VdbeMemSetInt64(Mem*, i64); | |
#ifdef SQLITE_OMIT_FLOATING_POINT | |
# define sqlite3VdbeMemSetDouble sqlite3VdbeMemSetInt64 | |
#else | |
- void sqlite3VdbeMemSetDouble(Mem*, double); | |
+ void sqlite3VdbeMemSetDouble(Mem*, sqlite_double); | |
#endif | |
void sqlite3VdbeMemInit(Mem*,sqlite3*,u16); | |
void sqlite3VdbeMemSetNull(Mem*); | |
void sqlite3VdbeMemSetZeroBlob(Mem*,int); | |
void sqlite3VdbeMemSetRowSet(Mem*); | |
int sqlite3VdbeMemMakeWriteable(Mem*); | |
int sqlite3VdbeMemStringify(Mem*, u8, u8); | |
i64 sqlite3VdbeIntValue(Mem*); | |
int sqlite3VdbeMemIntegerify(Mem*); | |
-double sqlite3VdbeRealValue(Mem*); | |
+sqlite_double sqlite3VdbeRealValue(Mem*); | |
void sqlite3VdbeIntegerAffinity(Mem*); | |
int sqlite3VdbeMemRealify(Mem*); | |
int sqlite3VdbeMemNumerify(Mem*); | |
void sqlite3VdbeMemCast(Mem*,u8,u8); | |
int sqlite3VdbeMemFromBtree(BtCursor*,u32,u32,int,Mem*); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- src/expr.c | |
+++ src/expr.c | |
@@ -2288,11 +2288,11 @@ | |
** z[n] character is guaranteed to be something that does not look | |
** like the continuation of the number. | |
*/ | |
static void codeReal(Vdbe *v, const char *z, int negateFlag, int iMem){ | |
if( ALWAYS(z!=0) ){ | |
- double value; | |
+ sqlite_double value; | |
sqlite3AtoF(z, &value, sqlite3Strlen30(z), SQLITE_UTF8); | |
assert( !sqlite3IsNaN(value) ); /* The new AtoF never returns NaN */ | |
if( negateFlag ) value = -value; | |
sqlite3VdbeAddOp4Dup8(v, OP_Real, 0, iMem, 0, (u8*)&value, P4_REAL); | |
} | |
--- src/func.c | |
+++ src/func.c | |
@@ -160,11 +160,11 @@ | |
/* Because sqlite3_value_double() returns 0.0 if the argument is not | |
** something that can be converted into a number, we have: | |
** IMP: R-01992-00519 Abs(X) returns 0.0 if X is a string or blob | |
** that cannot be converted to a numeric value. | |
*/ | |
- double rVal = sqlite3_value_double(argv[0]); | |
+ sqlite_double rVal = sqlite3_value_double(argv[0]); | |
if( rVal<0 ) rVal = -rVal; | |
sqlite3_result_double(context, rVal); | |
break; | |
} | |
} | |
@@ -354,11 +354,11 @@ | |
** Implementation of the round() function | |
*/ | |
#ifndef SQLITE_OMIT_FLOATING_POINT | |
static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ | |
int n = 0; | |
- double r; | |
+ sqlite_double r; | |
char *zBuf; | |
assert( argc==1 || argc==2 ); | |
if( argc==2 ){ | |
if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return; | |
n = sqlite3_value_int(argv[1]); | |
@@ -370,13 +370,13 @@ | |
/* If Y==0 and X will fit in a 64-bit int, | |
** handle the rounding directly, | |
** otherwise use printf. | |
*/ | |
if( n==0 && r>=0 && r<LARGEST_INT64-1 ){ | |
- r = (double)((sqlite_int64)(r+0.5)); | |
+ r = (sqlite_double)((sqlite_int64)(r+0.5)); | |
}else if( n==0 && r<0 && (-r)<LARGEST_INT64-1 ){ | |
- r = -(double)((sqlite_int64)((-r)+0.5)); | |
+ r = -(sqlite_double)((sqlite_int64)((-r)+0.5)); | |
}else{ | |
zBuf = sqlite3_mprintf("%.*f",n,r); | |
if( zBuf==0 ){ | |
sqlite3_result_error_nomem(context); | |
return; | |
@@ -971,11 +971,11 @@ | |
static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ | |
assert( argc==1 ); | |
UNUSED_PARAMETER(argc); | |
switch( sqlite3_value_type(argv[0]) ){ | |
case SQLITE_FLOAT: { | |
- double r1, r2; | |
+ sqlite_double r1, r2; | |
char zBuf[50]; | |
r1 = sqlite3_value_double(argv[0]); | |
sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.15g", r1); | |
sqlite3AtoF(zBuf, &r2, 20, SQLITE_UTF8); | |
if( r1!=r2 ){ | |
@@ -1411,11 +1411,11 @@ | |
** An instance of the following structure holds the context of a | |
** sum() or avg() aggregate computation. | |
*/ | |
typedef struct SumCtx SumCtx; | |
struct SumCtx { | |
- double rSum; /* Floating point sum */ | |
+ sqlite_double rSum; /* Floating point sum */ | |
i64 iSum; /* Integer sum */ | |
i64 cnt; /* Number of elements summed */ | |
u8 overflow; /* True if integer overflow seen */ | |
u8 approx; /* True if non-integer value was input to the sum */ | |
}; | |
@@ -1466,18 +1466,18 @@ | |
} | |
static void avgFinalize(sqlite3_context *context){ | |
SumCtx *p; | |
p = sqlite3_aggregate_context(context, 0); | |
if( p && p->cnt>0 ){ | |
- sqlite3_result_double(context, p->rSum/(double)p->cnt); | |
+ sqlite3_result_double(context, p->rSum/(sqlite_double)p->cnt); | |
} | |
} | |
static void totalFinalize(sqlite3_context *context){ | |
SumCtx *p; | |
p = sqlite3_aggregate_context(context, 0); | |
/* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */ | |
- sqlite3_result_double(context, p ? p->rSum : (double)0); | |
+ sqlite3_result_double(context, p ? p->rSum : (sqlite_double)0); | |
} | |
/* | |
** The following structure keeps track of state information for the | |
** count() aggregate function. | |
--- src/main.c | |
+++ src/main.c | |
@@ -266,11 +266,11 @@ | |
#ifndef NDEBUG | |
#ifndef SQLITE_OMIT_FLOATING_POINT | |
/* This section of code's only "output" is via assert() statements. */ | |
if ( rc==SQLITE_OK ){ | |
u64 x = (((u64)1)<<63)-1; | |
- double y; | |
+ sqlite_double y; | |
assert(sizeof(x)==8); | |
assert(sizeof(x)==sizeof(y)); | |
memcpy(&y, &x, 8); | |
assert( sqlite3IsNaN(y) ); | |
} | |
--- src/os.c | |
+++ src/os.c | |
@@ -270,11 +270,11 @@ | |
** unavailable. | |
*/ | |
if( pVfs->iVersion>=2 && pVfs->xCurrentTimeInt64 ){ | |
rc = pVfs->xCurrentTimeInt64(pVfs, pTimeOut); | |
}else{ | |
- double r; | |
+ sqlite_double r; | |
rc = pVfs->xCurrentTime(pVfs, &r); | |
*pTimeOut = (sqlite3_int64)(r*86400000.0); | |
} | |
return rc; | |
} | |
--- src/os_unix.c | |
+++ src/os_unix.c | |
@@ -6259,11 +6259,11 @@ | |
/* | |
** Find the current time (in Universal Coordinated Time). Write the | |
** current time and date as a Julian Day number into *prNow and | |
** return 0. Return 1 if the time and date cannot be found. | |
*/ | |
-static int unixCurrentTime(sqlite3_vfs *NotUsed, double *prNow){ | |
+static int unixCurrentTime(sqlite3_vfs *NotUsed, sqlite_double *prNow){ | |
sqlite3_int64 i = 0; | |
int rc; | |
UNUSED_PARAMETER(NotUsed); | |
rc = unixCurrentTimeInt64(0, &i); | |
*prNow = i/86400000.0; | |
--- src/os_win.c | |
+++ src/os_win.c | |
@@ -5761,11 +5761,11 @@ | |
/* | |
** Find the current time (in Universal Coordinated Time). Write the | |
** current time and date as a Julian Day number into *prNow and | |
** return 0. Return 1 if the time and date cannot be found. | |
*/ | |
-static int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){ | |
+static int winCurrentTime(sqlite3_vfs *pVfs, sqlite_double *prNow){ | |
int rc; | |
sqlite3_int64 i; | |
rc = winCurrentTimeInt64(pVfs, &i); | |
if( !rc ){ | |
*prNow = i/86400000.0; | |
--- src/printf.c | |
+++ src/printf.c | |
@@ -145,11 +145,11 @@ | |
*/ | |
static sqlite3_int64 getIntArg(PrintfArguments *p){ | |
if( p->nArg<=p->nUsed ) return 0; | |
return sqlite3_value_int64(p->apArg[p->nUsed++]); | |
} | |
-static double getDoubleArg(PrintfArguments *p){ | |
+static sqlite_double getDoubleArg(PrintfArguments *p){ | |
if( p->nArg<=p->nUsed ) return 0.0; | |
return sqlite3_value_double(p->apArg[p->nUsed++]); | |
} | |
static char *getTextArg(PrintfArguments *p){ | |
if( p->nArg<=p->nUsed ) return 0; | |
@@ -200,11 +200,11 @@ | |
int nOut; /* Size of the rendering buffer */ | |
char *zExtra = 0; /* Malloced memory used by some conversion */ | |
#ifndef SQLITE_OMIT_FLOATING_POINT | |
int exp, e2; /* exponent of real numbers */ | |
int nsd; /* Number of significant digits returned */ | |
- double rounder; /* Used for rounding floating point values */ | |
+ sqlite_double rounder; /* Used for rounding floating point values */ | |
etByte flag_dp; /* True if decimal point should be shown */ | |
etByte flag_rtz; /* True if trailing zeros should be removed */ | |
#endif | |
PrintfArguments *pArgList = 0; /* Arguments for SQLITE_PRINTF_SQLFUNC */ | |
char buf[etBUFSIZE]; /* Conversion buffer */ | |
@@ -451,11 +451,11 @@ | |
case etEXP: | |
case etGENERIC: | |
if( bArgList ){ | |
realvalue = getDoubleArg(pArgList); | |
}else{ | |
- realvalue = va_arg(ap,double); | |
+ realvalue = va_arg(ap,sqlite_double); | |
} | |
#ifdef SQLITE_OMIT_FLOATING_POINT | |
length = 0; | |
#else | |
if( precision<0 ) precision = 6; /* Set default precision */ | |
@@ -471,11 +471,11 @@ | |
testcase( precision>0xfff ); | |
for(idx=precision&0xfff, rounder=0.5; idx>0; idx--, rounder*=0.1){} | |
if( xtype==etFLOAT ) realvalue += rounder; | |
/* Normalize realvalue to within 10.0 > realvalue >= 1.0 */ | |
exp = 0; | |
- if( sqlite3IsNaN((double)realvalue) ){ | |
+ if( sqlite3IsNaN((sqlite_double)realvalue) ){ | |
bufpt = "NaN"; | |
length = 3; | |
break; | |
} | |
if( realvalue>0.0 ){ | |
--- src/resolve.c | |
+++ src/resolve.c | |
@@ -543,11 +543,11 @@ | |
** Expression p should encode a floating point value between 1.0 and 0.0. | |
** Return 1024 times this value. Or return -1 if p is not a floating point | |
** value between 1.0 and 0.0. | |
*/ | |
static int exprProbability(Expr *p){ | |
- double r = -1.0; | |
+ sqlite_double r = -1.0; | |
if( p->op!=TK_FLOAT ) return -1; | |
sqlite3AtoF(p->u.zToken, &r, sqlite3Strlen30(p->u.zToken), SQLITE_UTF8); | |
assert( r>=0.0 ); | |
if( r>1.0 ) return -1; | |
return (int)(r*134217728.0); | |
--- src/shell.c | |
+++ src/shell.c | |
@@ -175,11 +175,11 @@ | |
sqlite3_int64 t; | |
if( clockVfs==0 ) clockVfs = sqlite3_vfs_find(0); | |
if( clockVfs->iVersion>=2 && clockVfs->xCurrentTimeInt64!=0 ){ | |
clockVfs->xCurrentTimeInt64(clockVfs, &t); | |
}else{ | |
- double r; | |
+ sqlite_double r; | |
clockVfs->xCurrentTime(clockVfs, &r); | |
t = (sqlite3_int64)(r*86400000.0); | |
} | |
return t; | |
} | |
--- src/tclsqlite.c | |
+++ src/tclsqlite.c | |
@@ -847,11 +847,11 @@ | |
pVal = Tcl_NewWideIntObj(v); | |
} | |
break; | |
} | |
case SQLITE_FLOAT: { | |
- double r = sqlite3_value_double(pIn); | |
+ sqlite_double r = sqlite3_value_double(pIn); | |
pVal = Tcl_NewDoubleObj(r); | |
break; | |
} | |
case SQLITE_NULL: { | |
pVal = Tcl_NewStringObj(p->pDb->zNull, -1); | |
@@ -895,11 +895,11 @@ | |
sqlite3_result_blob(context, data, n, SQLITE_TRANSIENT); | |
}else if( c=='b' && strcmp(zType,"boolean")==0 ){ | |
Tcl_GetIntFromObj(0, pVar, &n); | |
sqlite3_result_int(context, n); | |
}else if( c=='d' && strcmp(zType,"double")==0 ){ | |
- double r; | |
+ sqlite_double r; | |
Tcl_GetDoubleFromObj(0, pVar, &r); | |
sqlite3_result_double(context, r); | |
}else if( (c=='w' && strcmp(zType,"wideInt")==0) || | |
(c=='i' && strcmp(zType,"int")==0) ){ | |
Tcl_WideInt v; | |
@@ -1248,11 +1248,11 @@ | |
pPreStmt->apParm[iParm++] = pVar; | |
}else if( c=='b' && strcmp(zType,"boolean")==0 ){ | |
Tcl_GetIntFromObj(interp, pVar, &n); | |
sqlite3_bind_int(pStmt, i, n); | |
}else if( c=='d' && strcmp(zType,"double")==0 ){ | |
- double r; | |
+ sqlite_double r; | |
Tcl_GetDoubleFromObj(interp, pVar, &r); | |
sqlite3_bind_double(pStmt, i, r); | |
}else if( (c=='w' && strcmp(zType,"wideInt")==0) || | |
(c=='i' && strcmp(zType,"int")==0) ){ | |
Tcl_WideInt v; | |
--- src/util.c | |
+++ src/util.c | |
@@ -54,11 +54,11 @@ | |
** Return true if the floating point value is Not a Number (NaN). | |
** | |
** Use the math library isnan() function if compiled with SQLITE_HAVE_ISNAN. | |
** Otherwise, we have our own implementation that works on most systems. | |
*/ | |
-int sqlite3IsNaN(double x){ | |
+int sqlite3IsNaN(sqlite_double x){ | |
int rc; /* The value return */ | |
#if !SQLITE_HAVE_ISNAN && !HAVE_ISNAN | |
/* | |
** Systems that support the isnan() library function should probably | |
** make use of it by compiling with -DSQLITE_HAVE_ISNAN. But we have | |
@@ -83,12 +83,12 @@ | |
** ... | |
*/ | |
#ifdef __FAST_MATH__ | |
# error SQLite will not work correctly with the -ffast-math option of GCC. | |
#endif | |
- volatile double y = x; | |
- volatile double z = y; | |
+ volatile sqlite_double y = x; | |
+ volatile sqlite_double z = y; | |
rc = (y!=z); | |
#else /* if HAVE_ISNAN */ | |
rc = isnan(x); | |
#endif /* HAVE_ISNAN */ | |
testcase( rc ); | |
@@ -340,11 +340,11 @@ | |
** | |
** If some prefix of the input string is a valid number, this routine | |
** returns FALSE but it still converts the prefix and writes the result | |
** into *pResult. | |
*/ | |
-int sqlite3AtoF(const char *z, double *pResult, int length, u8 enc){ | |
+int sqlite3AtoF(const char *z, sqlite_double *pResult, int length, u8 enc){ | |
#ifndef SQLITE_OMIT_FLOATING_POINT | |
int incr; | |
const char *zEnd = z + length; | |
/* sign * significand * (10 ^ (esign * exponent)) */ | |
int sign = 1; /* sign of significand */ | |
@@ -351,11 +351,11 @@ | |
i64 s = 0; /* significand */ | |
int d = 0; /* adjust exponent for shifting decimal point */ | |
int esign = 1; /* sign of exponent */ | |
int e = 0; /* exponent */ | |
int eValid = 1; /* True exponent is either not used or is well-formed */ | |
- double result; | |
+ sqlite_double result; | |
int nDigits = 0; | |
int nonNum = 0; /* True if input contains UTF16 with high byte non-zero */ | |
assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE ); | |
*pResult = 0.0; /* Default return value, in case of an error */ | |
@@ -448,11 +448,11 @@ | |
esign = 1; | |
} | |
if( s==0 ) { | |
/* In the IEEE 754 standard, zero is signed. */ | |
- result = sign<0 ? -(double)0 : (double)0; | |
+ result = sign<0 ? -(sqlite_double)0 : (sqlite_double)0; | |
} else { | |
/* Attempt to reduce exponent. | |
** | |
** Branches that are not required for the correct answer but which only | |
** help to obtain the correct answer faster are marked with special | |
@@ -471,11 +471,11 @@ | |
/* adjust the sign of significand */ | |
s = sign<0 ? -s : s; | |
if( e==0 ){ /*OPTIMIZATION-IF-TRUE*/ | |
- result = (double)s; | |
+ result = (sqlite_double)s; | |
}else{ | |
LONGDOUBLE_TYPE scale = 1.0; | |
/* attempt to handle extremely small/large numbers better */ | |
if( e>307 ){ /*OPTIMIZATION-IF-TRUE*/ | |
if( e<342 ){ /*OPTIMIZATION-IF-TRUE*/ | |
@@ -1428,11 +1428,11 @@ | |
#ifndef SQLITE_OMIT_VIRTUALTABLE | |
/* | |
** Convert a double into a LogEst | |
** In other words, compute an approximation for 10*log2(x). | |
*/ | |
-LogEst sqlite3LogEstFromDouble(double x){ | |
+LogEst sqlite3LogEstFromDouble(sqlite_double x){ | |
u64 a; | |
LogEst e; | |
assert( sizeof(x)==8 && sizeof(a)==8 ); | |
if( x<=1 ) return 0; | |
if( x<=2000000000 ) return sqlite3LogEst((u64)x); | |
--- src/vdbe.c | |
+++ src/vdbe.c | |
@@ -249,11 +249,11 @@ | |
** If bTryForInt is false, then if the input string contains a decimal | |
** point or exponential notation, the result is only MEM_Real, even | |
** if there is an exact integer representation of the quantity. | |
*/ | |
static void applyNumericAffinity(Mem *pRec, int bTryForInt){ | |
- double rValue; | |
+ sqlite_double rValue; | |
i64 iValue; | |
u8 enc = pRec->enc; | |
assert( (pRec->flags & (MEM_Str|MEM_Int|MEM_Real))==MEM_Str ); | |
if( sqlite3AtoF(pRec->z, &rValue, pRec->n, enc)==0 ) return; | |
if( 0==sqlite3Atoi64(pRec->z, &iValue, pRec->n, enc) ){ | |
@@ -1485,12 +1485,12 @@ | |
u16 flags; /* Combined MEM_* flags from both inputs */ | |
u16 type1; /* Numeric type of left operand */ | |
u16 type2; /* Numeric type of right operand */ | |
i64 iA; /* Integer value of left operand */ | |
i64 iB; /* Integer value of right operand */ | |
- double rA; /* Real value of left operand */ | |
- double rB; /* Real value of right operand */ | |
+ sqlite_double rA; /* Real value of left operand */ | |
+ sqlite_double rB; /* Real value of right operand */ | |
pIn1 = &aMem[pOp->p1]; | |
type1 = numericType(pIn1); | |
pIn2 = &aMem[pOp->p2]; | |
type2 = numericType(pIn2); | |
@@ -1529,20 +1529,20 @@ | |
case OP_Add: rB += rA; break; | |
case OP_Subtract: rB -= rA; break; | |
case OP_Multiply: rB *= rA; break; | |
case OP_Divide: { | |
/* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */ | |
- if( rA==(double)0 ) goto arithmetic_result_is_null; | |
+ if( rA==(sqlite_double)0 ) goto arithmetic_result_is_null; | |
rB /= rA; | |
break; | |
} | |
default: { | |
iA = (i64)rA; | |
iB = (i64)rB; | |
if( iA==0 ) goto arithmetic_result_is_null; | |
if( iA==-1 ) iA = 1; | |
- rB = (double)(iB % iA); | |
+ rB = (sqlite_double)(iB % iA); | |
break; | |
} | |
} | |
#ifdef SQLITE_OMIT_FLOATING_POINT | |
pOut->u.i = rB; | |
@@ -3758,20 +3758,20 @@ | |
** is 4.9 and the integer approximation 5: | |
** | |
** (x > 4.9) -> (x >= 5) | |
** (x <= 4.9) -> (x < 5) | |
*/ | |
- if( pIn3->u.r<(double)iKey ){ | |
+ if( pIn3->u.r<(sqlite_double)iKey ){ | |
assert( OP_SeekGE==(OP_SeekGT-1) ); | |
assert( OP_SeekLT==(OP_SeekLE-1) ); | |
assert( (OP_SeekLE & 0x0001)==(OP_SeekGT & 0x0001) ); | |
if( (oc & 0x0001)==(OP_SeekGT & 0x0001) ) oc--; | |
} | |
/* If the approximation iKey is smaller than the actual real search | |
** term, substitute <= for < and > for >=. */ | |
- else if( pIn3->u.r>(double)iKey ){ | |
+ else if( pIn3->u.r>(sqlite_double)iKey ){ | |
assert( OP_SeekLE==(OP_SeekLT+1) ); | |
assert( OP_SeekGT==(OP_SeekGE+1) ); | |
assert( (OP_SeekLT & 0x0001)==(OP_SeekGE & 0x0001) ); | |
if( (oc & 0x0001)==(OP_SeekLT & 0x0001) ) oc++; | |
} | |
--- src/vdbeapi.c | |
+++ src/vdbeapi.c | |
@@ -176,11 +176,11 @@ | |
return sqlite3ValueBytes(pVal, SQLITE_UTF8); | |
} | |
int sqlite3_value_bytes16(sqlite3_value *pVal){ | |
return sqlite3ValueBytes(pVal, SQLITE_UTF16NATIVE); | |
} | |
-double sqlite3_value_double(sqlite3_value *pVal){ | |
+sqlite_double sqlite3_value_double(sqlite3_value *pVal){ | |
return sqlite3VdbeRealValue((Mem*)pVal); | |
} | |
int sqlite3_value_int(sqlite3_value *pVal){ | |
return (int)sqlite3VdbeIntValue((Mem*)pVal); | |
} | |
@@ -337,11 +337,11 @@ | |
(void)invokeValueDestructor(z, xDel, pCtx); | |
}else{ | |
setResultStrOrError(pCtx, z, (int)n, 0, xDel); | |
} | |
} | |
-void sqlite3_result_double(sqlite3_context *pCtx, double rVal){ | |
+void sqlite3_result_double(sqlite3_context *pCtx, sqlite_double rVal){ | |
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); | |
sqlite3VdbeMemSetDouble(pCtx->pOut, rVal); | |
} | |
void sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){ | |
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); | |
@@ -1011,12 +1011,12 @@ | |
int sqlite3_column_bytes16(sqlite3_stmt *pStmt, int i){ | |
int val = sqlite3_value_bytes16( columnMem(pStmt,i) ); | |
columnMallocFailure(pStmt); | |
return val; | |
} | |
-double sqlite3_column_double(sqlite3_stmt *pStmt, int i){ | |
- double val = sqlite3_value_double( columnMem(pStmt,i) ); | |
+sqlite_double sqlite3_column_double(sqlite3_stmt *pStmt, int i){ | |
+ sqlite_double val = sqlite3_value_double( columnMem(pStmt,i) ); | |
columnMallocFailure(pStmt); | |
return val; | |
} | |
int sqlite3_column_int(sqlite3_stmt *pStmt, int i){ | |
int val = sqlite3_value_int( columnMem(pStmt,i) ); | |
@@ -1318,11 +1318,11 @@ | |
return invokeValueDestructor(zData, xDel, 0); | |
}else{ | |
return bindText(pStmt, i, zData, (int)nData, xDel, 0); | |
} | |
} | |
-int sqlite3_bind_double(sqlite3_stmt *pStmt, int i, double rValue){ | |
+int sqlite3_bind_double(sqlite3_stmt *pStmt, int i, sqlite_double rValue){ | |
int rc; | |
Vdbe *p = (Vdbe *)pStmt; | |
rc = vdbeUnbind(p, i); | |
if( rc==SQLITE_OK ){ | |
sqlite3VdbeMemSetDouble(&p->aVar[i-1], rValue); | |
@@ -1806,17 +1806,17 @@ | |
case SQLITE_SCANSTAT_NVISIT: { | |
*(sqlite3_int64*)pOut = p->anExec[pScan->addrVisit]; | |
break; | |
} | |
case SQLITE_SCANSTAT_EST: { | |
- double r = 1.0; | |
+ sqlite_double r = 1.0; | |
LogEst x = pScan->nEst; | |
while( x<100 ){ | |
x += 10; | |
r *= 0.5; | |
} | |
- *(double*)pOut = r*sqlite3LogEstToInt(x); | |
+ *(sqlite_double*)pOut = r*sqlite3LogEstToInt(x); | |
break; | |
} | |
case SQLITE_SCANSTAT_NAME: { | |
*(const char**)pOut = pScan->zName; | |
break; | |
--- src/vdbeaux.c | |
+++ src/vdbeaux.c | |
@@ -3351,11 +3351,11 @@ | |
** byte order. Or, that if SQLITE_MIXED_ENDIAN_64BIT_FLOAT is | |
** defined that 64-bit floating point values really are mixed | |
** endian. | |
*/ | |
static const u64 t1 = ((u64)0x3ff00000)<<32; | |
- static const double r1 = 1.0; | |
+ static const sqlite_double r1 = 1.0; | |
u64 t2 = t1; | |
swapMixedEndianFloat(t2); | |
assert( sizeof(r1)==sizeof(t2) && memcmp(&r1, &t2, sizeof(r1))==0 ); | |
#endif | |
assert( sizeof(x)==8 && sizeof(pMem->u.r)==8 ); | |
@@ -3727,30 +3727,30 @@ | |
} | |
/* | |
** Do a comparison between a 64-bit signed integer and a 64-bit floating-point | |
** number. Return negative, zero, or positive if the first (i64) is less than, | |
-** equal to, or greater than the second (double). | |
+** equal to, or greater than the second (sqlite_double). | |
*/ | |
-static int sqlite3IntFloatCompare(i64 i, double r){ | |
+static int sqlite3IntFloatCompare(i64 i, sqlite_double r){ | |
if( sizeof(LONGDOUBLE_TYPE)>8 ){ | |
LONGDOUBLE_TYPE x = (LONGDOUBLE_TYPE)i; | |
if( x<r ) return -1; | |
if( x>r ) return +1; | |
return 0; | |
}else{ | |
i64 y; | |
- double s; | |
+ sqlite_double s; | |
if( r<-9223372036854775808.0 ) return +1; | |
if( r>9223372036854775807.0 ) return -1; | |
y = (i64)r; | |
if( i<y ) return -1; | |
if( i>y ){ | |
if( y==SMALLEST_INT64 && r>0.0 ) return -1; | |
return +1; | |
} | |
- s = (double)i; | |
+ s = (sqlite_double)i; | |
if( s<r ) return -1; | |
if( s>r ) return +1; | |
return 0; | |
} | |
} | |
--- src/vdbemem.c | |
+++ src/vdbemem.c | |
@@ -418,11 +418,11 @@ | |
/* | |
** Convert a 64-bit IEEE double into a 64-bit signed integer. | |
** If the double is out of range of a 64-bit signed integer then | |
** return the closest available 64-bit signed integer. | |
*/ | |
-static i64 doubleToInt64(double r){ | |
+static i64 doubleToInt64(sqlite_double r){ | |
#ifdef SQLITE_OMIT_FLOATING_POINT | |
/* When floating-point is omitted, double and int64 are the same thing */ | |
return r; | |
#else | |
/* | |
@@ -433,13 +433,13 @@ | |
** larger than a 32-bit integer constant. | |
*/ | |
static const i64 maxInt = LARGEST_INT64; | |
static const i64 minInt = SMALLEST_INT64; | |
- if( r<=(double)minInt ){ | |
+ if( r<=(sqlite_double)minInt ){ | |
return minInt; | |
- }else if( r>=(double)maxInt ){ | |
+ }else if( r>=(sqlite_double)maxInt ){ | |
return maxInt; | |
}else{ | |
return (i64)r; | |
} | |
#endif | |
@@ -479,25 +479,25 @@ | |
** Return the best representation of pMem that we can get into a | |
** double. If pMem is already a double or an integer, return its | |
** value. If it is a string or blob, try to convert it to a double. | |
** If it is a NULL, return 0.0. | |
*/ | |
-double sqlite3VdbeRealValue(Mem *pMem){ | |
+sqlite_double sqlite3VdbeRealValue(Mem *pMem){ | |
assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); | |
assert( EIGHT_BYTE_ALIGNMENT(pMem) ); | |
if( pMem->flags & MEM_Real ){ | |
return pMem->u.r; | |
}else if( pMem->flags & MEM_Int ){ | |
- return (double)pMem->u.i; | |
+ return (sqlite_double)pMem->u.i; | |
}else if( pMem->flags & (MEM_Str|MEM_Blob) ){ | |
- /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */ | |
- double val = (double)0; | |
+ /* (sqlite_double)0 In case of SQLITE_OMIT_FLOATING_POINT... */ | |
+ sqlite_double val = (sqlite_double)0; | |
sqlite3AtoF(pMem->z, &val, pMem->n, pMem->enc); | |
return val; | |
}else{ | |
- /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */ | |
- return (double)0; | |
+ /* (sqlite_double)0 In case of SQLITE_OMIT_FLOATING_POINT... */ | |
+ return (sqlite_double)0; | |
} | |
} | |
/* | |
** The MEM structure is already a MEM_Real. Try to also make it a | |
@@ -700,11 +700,11 @@ | |
#ifndef SQLITE_OMIT_FLOATING_POINT | |
/* | |
** Delete any previous value and set the value stored in *pMem to val, | |
** manifest type REAL. | |
*/ | |
-void sqlite3VdbeMemSetDouble(Mem *pMem, double val){ | |
+void sqlite3VdbeMemSetDouble(Mem *pMem, sqlite_double val){ | |
sqlite3VdbeMemSetNull(pMem); | |
if( !sqlite3IsNaN(val) ){ | |
pMem->u.r = val; | |
pMem->flags = MEM_Real; | |
} | |
@@ -1334,11 +1334,11 @@ | |
){ | |
sqlite3VdbeMemNumerify(pVal); | |
if( pVal->flags & MEM_Real ){ | |
pVal->u.r = -pVal->u.r; | |
}else if( pVal->u.i==SMALLEST_INT64 ){ | |
- pVal->u.r = -(double)SMALLEST_INT64; | |
+ pVal->u.r = -(sqlite_double)SMALLEST_INT64; | |
MemSetTypeFlag(pVal, MEM_Real); | |
}else{ | |
pVal->u.i = -pVal->u.i; | |
} | |
sqlite3ValueApplyAffinity(pVal, affinity, enc); | |
--- src/where.c | |
+++ src/where.c | |
@@ -2865,11 +2865,11 @@ | |
memset(pUsage, 0, sizeof(pUsage[0])*nConstraint); | |
assert( pIdxInfo->needToFreeIdxStr==0 ); | |
pIdxInfo->idxStr = 0; | |
pIdxInfo->idxNum = 0; | |
pIdxInfo->orderByConsumed = 0; | |
- pIdxInfo->estimatedCost = SQLITE_BIG_DBL / (double)2; | |
+ pIdxInfo->estimatedCost = SQLITE_BIG_DBL / (sqlite_double)2; | |
pIdxInfo->estimatedRows = 25; | |
pIdxInfo->idxFlags = 0; | |
pIdxInfo->colUsed = (sqlite3_int64)pSrc->colUsed; | |
/* Invoke the virtual table xBestIndex() method */ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment