diff options
author | shane <shane@noemail.net> | 2009-02-04 03:59:25 +0000 |
---|---|---|
committer | shane <shane@noemail.net> | 2009-02-04 03:59:25 +0000 |
commit | fbd60f826d0276401c6dd3d085ce4ebb7843836e (patch) | |
tree | d841324093c9e0c02e0268fcb52baab06a5e48a3 /src/func.c | |
parent | 63207ab2623be80c0a63c777f71e86d81d732f1d (diff) | |
download | sqlite-fbd60f826d0276401c6dd3d085ce4ebb7843836e.tar.gz sqlite-fbd60f826d0276401c6dd3d085ce4ebb7843836e.zip |
Changes to completely remove all floating point ops if SQLITE_OMIT_FLOATING_POINT defined. Note that w/o fp, date/time, round, nan, etc. are all gone or limited in functionality. Updated some of the test scripts to support missing fp and 64-bit functionality. Ticket #3029. (CVS 6250)
FossilOrigin-Name: 5cef400023205b55152b91441acc78f9cd8d58a9
Diffstat (limited to 'src/func.c')
-rw-r--r-- | src/func.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/func.c b/src/func.c index 85af9e0e9..07671ff6b 100644 --- a/src/func.c +++ b/src/func.c @@ -16,7 +16,7 @@ ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: func.c,v 1.221 2009/02/03 15:50:34 drh Exp $ +** $Id: func.c,v 1.222 2009/02/04 03:59:25 shane Exp $ */ #include "sqliteInt.h" #include <stdlib.h> @@ -243,6 +243,7 @@ static void substrFunc( /* ** 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; @@ -260,6 +261,7 @@ static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ sqlite3AtoF(zBuf, &r); sqlite3_result_double(context, r); } +#endif /* ** Allocate nByte bytes of space using sqlite3_malloc(). If the @@ -1131,7 +1133,8 @@ static void avgFinalize(sqlite3_context *context){ static void totalFinalize(sqlite3_context *context){ SumCtx *p; p = sqlite3_aggregate_context(context, 0); - sqlite3_result_double(context, p ? p->rSum : 0.0); + /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */ + sqlite3_result_double(context, p ? p->rSum : (double)0); } /* @@ -1378,8 +1381,10 @@ void sqlite3RegisterGlobalFunctions(void){ FUNCTION(substr, 2, 0, 0, substrFunc ), FUNCTION(substr, 3, 0, 0, substrFunc ), FUNCTION(abs, 1, 0, 0, absFunc ), +#ifndef SQLITE_OMIT_FLOATING_POINT FUNCTION(round, 1, 0, 0, roundFunc ), FUNCTION(round, 2, 0, 0, roundFunc ), +#endif FUNCTION(upper, 1, 0, 0, upperFunc ), FUNCTION(lower, 1, 0, 0, lowerFunc ), FUNCTION(coalesce, 1, 0, 0, 0 ), |