]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Changes to completely remove all floating point ops if SQLITE_OMIT_FLOATING_POINT...
authorshane <shane@noemail.net>
Wed, 4 Feb 2009 03:59:25 +0000 (03:59 +0000)
committershane <shane@noemail.net>
Wed, 4 Feb 2009 03:59:25 +0000 (03:59 +0000)
FossilOrigin-Name: 5cef400023205b55152b91441acc78f9cd8d58a9

14 files changed:
manifest
manifest.uuid
src/date.c
src/expr.c
src/func.c
src/main.c
src/os_win.c
src/util.c
src/vdbe.c
src/vdbeapi.c
src/vdbemem.c
src/where.c
test/expr.test
test/func.test

index 24dc3375750a4cd891a09edd87964c7e9e25bb22..7f2e341df84a41f180143c30a3847ab5db858141 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\scompiler\swarnings\sunder\sMSVC.\s(CVS\s6249)
-D 2009-02-04T01:49:30
+C Changes\sto\scompletely\sremove\sall\sfloating\spoint\sops\sif\sSQLITE_OMIT_FLOATING_POINT\sdefined.\s\sNote\sthat\sw/o\sfp,\sdate/time,\sround,\snan,\setc.\sare\sall\sgone\sor\slimited\sin\sfunctionality.\s\s\sUpdated\ssome\sof\sthe\stest\sscripts\sto\ssupport\smissing\sfp\sand\s64-bit\sfunctionality.\s\s\sTicket\s#3029.\s(CVS\s6250)
+D 2009-02-04T03:59:25
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in c7a5a30fb6852bd7839b1024e1661da8549878ee
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -110,11 +110,11 @@ F src/btreeInt.h 0a4884e6152d7cae9c741e91b830064c19fd2c05
 F src/build.c 6f3d5f74e262d561d77f0210c6063b7122f16c98
 F src/callback.c 5f10bca853e59a2c272bbfd5b720303f8b69e520
 F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c
-F src/date.c 870770dde3fb56772ab247dfb6a6eda44d16cfbc
+F src/date.c 0d804df3bbda46329946a01ff5c75c3f4f135218
 F src/delete.c 6249005bdd8f85db6ec5f31ddb5c07de023693cc
-F src/expr.c 76dc3dc83b56ab8db50a772714fac49def8bbf12
+F src/expr.c e60f69f624a03a8f493900b071b3affbfa699585
 F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff
-F src/func.c ec95417daf260fe574d8a6500946db30e88242ed
+F src/func.c 35d6f4a98c5fd5d504fd92a9197bae3220bbac39
 F src/global.c ab003581ea4ff193cfe17a00e1303bc51db619a5
 F src/hash.c 5824e6ff7ba78cd34c8d6cd724367713583e5b55
 F src/hash.h 28f38ebb1006a5beedcb013bcdfe31befe7437ae
@@ -123,7 +123,7 @@ F src/insert.c f6db1e6f43aae337e64a755208abb6ff124edc19
 F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0
 F src/legacy.c 8b3b95d48d202614946d7ce7256e7ba898905c3b
 F src/loadext.c 3f96631089fc4f3871a67f02f2e4fc7ea4d51edc
-F src/main.c da51988dd4d75de4ccc66d2c99dd1b5b3b266e6c
+F src/main.c abc8351627679bcf95ddc0539360ee93c00ac8cc
 F src/malloc.c bc408056b126db37b6fba00e170d578cc67be6b3
 F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
 F src/mem1.c 3bfb39e4f60b0179713a7c087b2d4f0dc205735f
@@ -142,7 +142,7 @@ F src/os.h f996ab57d2035a20e63173419055608548a834c6
 F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
 F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5
 F src/os_unix.c f0fce3042011d462b8ae633564a5668260bd3636
-F src/os_win.c ec133f2a3c0da786995ea09ba67056af8f18cc2e
+F src/os_win.c b83b57c24ec5bca07cb0eca6f620e796209e952f
 F src/pager.c 1181eac160b1bc58108deb013624437ed695d15f
 F src/pager.h 0c9f3520c00d8a3b8e792ca56c9a11b6b02b4b0f
 F src/parse.y 4f4d16aee0d11f69fec2adb77dac88878043ed8d
@@ -198,18 +198,18 @@ F src/tokenize.c 6987fb7f0d6a87ac53499aee568cabb05eb4bea8
 F src/trigger.c ca6d78f7c1314053800386ca64361e487774fda3
 F src/update.c 8c4925f9ca664effc8a1faaad67449d2074567b1
 F src/utf.c 1da9c832dba0fa8f865b5b902d93f420a1ee4245
-F src/util.c f1ac1bcd3ec5e3300982031504659b6f9435de33
+F src/util.c 1363f64351f3b544790f3c523439354c02f8c4e9
 F src/vacuum.c 4929a585ef0fb1dfaf46302f8a9c4aa30c2d9cf5
-F src/vdbe.c 81120d5a5ba2d93eb7d7f66e814bbc811305daa2
+F src/vdbe.c c719017876405d32c9f342e39dc5b10dceff5811
 F src/vdbe.h 03516f28bf5aca00a53c4dccd6c313f96adb94f6
 F src/vdbeInt.h 13cb4868ea579b5a8f6b6b5098caa99cd5a14078
-F src/vdbeapi.c 85c33cfbfa56249cbe627831610afafba754477d
+F src/vdbeapi.c b23c4b1686f150a0ddc36459c8e3876be62638e1
 F src/vdbeaux.c 75c3ac2a3c37747ae66ea0935f8f48bb1879234a
 F src/vdbeblob.c b0dcebfafedcf9c0addc7901ad98f6f986c08935
-F src/vdbemem.c c6127c335f802ba159c6fec4e3284ba82a070602
+F src/vdbemem.c 543a79d722734d2f8b7ad70f08218c30bcc5bbf5
 F src/vtab.c e39e011d7443a8d574b1b9cde207a35522e6df43
 F src/walker.c 488c2660e13224ff70c0c82761118efb547f8f0d
-F src/where.c fb89dfb2d9f99ed75c8bff6148fdae07791d7a91
+F src/where.c 63bb752784b352d8e226dc6b1ec02f0d19fed916
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/alias.test 597662c5d777a122f9a3df0047ea5c5bd383a911
 F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45
@@ -314,7 +314,7 @@ F test/eval.test bc269c365ba877554948441e91ad5373f9f91be3
 F test/exclusive.test cb991e44aa7cf744976143afce18586920f6696a
 F test/exclusive2.test 6bdf254770a843c2933b54bee9ed239934f0a183
 F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7
-F test/expr.test bc1e6997c27238f6de539f1079ff93e5078ea7c3
+F test/expr.test 80f3cf99f786ffbac19d2b0083673e7fc797030f
 F test/filectrl.test 8923a6dc7630f31c8a9dd3d3d740aa0922df7bf8
 F test/filefmt.test 053b622009fbbb74dd37921ffad374d852c13cd8
 F test/fkey1.test 78506fa55800d553d8fe1f3e7f73ce996fd2cef9
@@ -377,7 +377,7 @@ F test/fts3e.test 1f6c6ac9cc8b772ca256e6b22aaeed50c9350851
 F test/fts3expr.test 000f05df771e203187ceac49ad21c303c720b783
 F test/fts3expr2.test 8501de895a4c0631e7226c9bac055cd49c9f6646
 F test/fts3near.test dc196dd17b4606f440c580d45b3d23aa975fd077
-F test/func.test e40978f08973f5956cfd32a7f87ef427e39cf9d3
+F test/func.test 70ea3d5b10d40cbc87a19b0819d2842dbcdb31f2
 F test/fuzz.test 8bad3b9b09bad47c50f3433f9598707a70247ce1
 F test/fuzz2.test ea38692ce2da99ad79fe0be5eb1a452c1c4d37bb
 F test/fuzz3.test aec64345184d1662bd30e6a17851ff659d596dc5
@@ -700,7 +700,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 7f827ba9d7af2dfe44aed386b4407716c85daf5e
-R 64bfcfe14f6ed5f9fc8ac6244bf9afce
+P 6301f08a2b32289a49c4af994f2770318c444b49
+R 1e107d374c57a504206ef2bd99db8710
 U shane
-Z 3dacbef726dfade40da5a8d7ccd5cff0
+Z a11c50747a0f4d959a770fa2e57dbba2
index d75fe47d444948a091d0fccc1bc210075fdbe3f1..41d95a30720c6c6de2489c5254278b123a7ef5f2 100644 (file)
@@ -1 +1 @@
-6301f08a2b32289a49c4af994f2770318c444b49
\ No newline at end of file
+5cef400023205b55152b91441acc78f9cd8d58a9
\ No newline at end of file
index c8aeceffbab1e1fe44148127361a4ff8b5bcf545..0fa1ee98d51fc05ab89d433c0e6fe76ed4c5ce7d 100644 (file)
@@ -16,7 +16,7 @@
 ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
 ** All other code has file scope.
 **
-** $Id: date.c,v 1.102 2009/01/30 17:27:44 drh Exp $
+** $Id: date.c,v 1.103 2009/02/04 03:59:25 shane Exp $
 **
 ** SQLite processes all times and dates as Julian Day numbers.  The
 ** dates and times are stored as the number of days since noon
@@ -1042,9 +1042,19 @@ static void currentTimeFunc(
   double rT;
   char zBuf[20];
 
+  UNUSED_PARAMETER(argc);
+  UNUSED_PARAMETER(argv);
+
   db = sqlite3_context_db_handle(context);
   sqlite3OsCurrentTime(db->pVfs, &rT);
+#ifndef SQLITE_OMIT_FLOATING_POINT
   t = 86400.0*(rT - 2440587.5) + 0.5;
+#else
+  /* without floating point support, rT will have
+  ** already lost fractional day precision.
+  */
+  t = 86400 * (rT - 2440587) - 43200;
+#endif
 #ifdef HAVE_GMTIME_R
   {
     struct tm sNow;
index 746b598a8c8b5bda145922c355fe4c22a116532f..8960a7ad93367cbedf636b231cab8082d182adcc 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains routines used for analyzing expressions and
 ** for generating VDBE code that evaluates expressions in SQLite.
 **
-** $Id: expr.c,v 1.410 2009/01/20 16:53:40 danielk1977 Exp $
+** $Id: expr.c,v 1.411 2009/02/04 03:59:25 shane Exp $
 */
 #include "sqliteInt.h"
 
@@ -1932,12 +1932,10 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
     case TK_UMINUS: {
       Expr *pLeft = pExpr->pLeft;
       assert( pLeft );
-      if( pLeft->op==TK_FLOAT || pLeft->op==TK_INTEGER ){
-        if( pLeft->op==TK_FLOAT ){
-          codeReal(v, (char*)pLeft->token.z, pLeft->token.n, 1, target);
-        }else{
-          codeInteger(v, pLeft, 1, target);
-        }
+      if( pLeft->op==TK_FLOAT ){
+        codeReal(v, (char*)pLeft->token.z, pLeft->token.n, 1, target);
+      }else if( pLeft->op==TK_INTEGER ){
+        codeInteger(v, pLeft, 1, target);
       }else{
         regFree1 = r1 = sqlite3GetTempReg(pParse);
         sqlite3VdbeAddOp2(v, OP_Integer, 0, r1);
index 85af9e0e95e67c2543934a86fd132e1c42fbf892..07671ff6ba550532d35bba4209d8804f96885dfb 100644 (file)
@@ -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                ),
index 58f5443ca3ff4303b8d4c467e7322fead855b622..31acd559f33685a7e2622f302be9711cd55f5aa1 100644 (file)
@@ -14,7 +14,7 @@
 ** other files are for internal use by SQLite and should not be
 ** accessed by users of the library.
 **
-** $Id: main.c,v 1.525 2009/02/03 16:51:25 danielk1977 Exp $
+** $Id: main.c,v 1.526 2009/02/04 03:59:25 shane Exp $
 */
 #include "sqliteInt.h"
 
@@ -191,6 +191,7 @@ int sqlite3_initialize(void){
   ** reason.  So we run it once during initialization.
   */
 #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;
@@ -200,6 +201,7 @@ int sqlite3_initialize(void){
     memcpy(&y, &x, 8);
     assert( sqlite3IsNaN(y) );
   }
+#endif
 #endif
 
   return rc;
index 636e9e686df9085c3b9ed39e9c9298a200f245b4..02f4f7333f66f3d78d123dcd8ac4495a6382c8df 100644 (file)
@@ -12,7 +12,7 @@
 **
 ** This file contains code that is specific to windows.
 **
-** $Id: os_win.c,v 1.146 2009/01/30 05:59:11 shane Exp $
+** $Id: os_win.c,v 1.147 2009/02/04 03:59:25 shane Exp $
 */
 #include "sqliteInt.h"
 #if SQLITE_OS_WIN               /* This file is used for windows only */
@@ -755,10 +755,10 @@ int sqlite3_fullsync_count = 0;
 static int winSync(sqlite3_file *id, int flags){
 #ifndef SQLITE_NO_SYNC
   winFile *pFile = (winFile*)id;
+  OSTRACE3("SYNC %d lock=%d\n", pFile->h, pFile->locktype);
 #else
   UNUSED_PARAMETER(id);
 #endif
-  OSTRACE3("SYNC %d lock=%d\n", pFile->h, pFile->locktype);
 #ifndef SQLITE_TEST
   UNUSED_PARAMETER(flags);
 #else
@@ -1672,7 +1672,7 @@ int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){
   /* FILETIME structure is a 64-bit value representing the number of 
      100-nanosecond intervals since January 1, 1601 (= JD 2305813.5). 
   */
-  double now;
+  sqlite3_int64 timeW, timeF;
 #if SQLITE_OS_WINCE
   SYSTEMTIME time;
   GetSystemTime(&time);
@@ -1684,11 +1684,28 @@ int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){
   GetSystemTimeAsFileTime( &ft );
 #endif
   UNUSED_PARAMETER(pVfs);
-  now = ((double)ft.dwHighDateTime) * 4294967296.0; 
-  *prNow = (now + ft.dwLowDateTime)/864000000000.0 + 2305813.5;
+#if defined(_MSC_VER)
+  timeW = (((sqlite3_int64)ft.dwHighDateTime)*4294967296) + ft.dwLowDateTime;
+  timeF = timeW % 864000000000;           /* fractional days (100-nanoseconds) */
+  timeW = timeW / 864000000000;           /* whole days */
+  timeW = timeW + 2305813;                /* add whole days (from 2305813.5) */
+  timeF = timeF + 432000000000;           /* add half a day (from 2305813.5) */
+  timeW = timeW + (timeF / 864000000000); /* add whole day if half day made one */
+  timeF = timeF % 864000000000;           /* compute new fractional days */
+  *prNow = (double)timeW + ((double)timeF / (double)864000000000);
+#else
+  timeW = (((sqlite3_int64)ft.dwHighDateTime)*4294967296LL) + ft.dwLowDateTime;
+  timeF = timeW % 864000000000LL;           /* fractional days (100-nanoseconds) */
+  timeW = timeW / 864000000000LL;           /* whole days */
+  timeW = timeW + 2305813;                  /* add whole days (from 2305813.5) */
+  timeF = timeF + 432000000000LL;           /* add half a day (from 2305813.5) */
+  timeW = timeW + (timeF / 864000000000LL); /* add whole day if half day made one */
+  timeF = timeF % 864000000000LL;           /* compute new fractional days */
+  *prNow = (double)timeW + ((double)timeF / (double)864000000000LL);
+#endif
 #ifdef SQLITE_TEST
   if( sqlite3_current_time ){
-    *prNow = sqlite3_current_time/86400.0 + 2440587.5;
+    *prNow = ((double)sqlite3_current_time + (double)43200) / (double)86400 + (double)2440587;
   }
 #endif
   return 0;
index 4eb01b0da1cd59ab3805b91082b5da5a888284fa..829dfe8474d07ea51a751f7adf61edb0a807edb4 100644 (file)
 ** This file contains functions for allocating memory, comparing
 ** strings, and stuff like that.
 **
-** $Id: util.c,v 1.247 2009/01/20 16:53:41 danielk1977 Exp $
+** $Id: util.c,v 1.248 2009/02/04 03:59:25 shane Exp $
 */
 #include "sqliteInt.h"
 #include <stdarg.h>
 
-
 /*
 ** Routine needed to support the testcase() macro.
 */
index b6da22237ceda1cf3ffaf9f91ee02a537c6315cd..1028e816317e61b789f6c7455e0dd63e830df617 100644 (file)
@@ -43,7 +43,7 @@
 ** in this file for details.  If in doubt, do not deviate from existing
 ** commenting and indentation practices when changing or adding code.
 **
-** $Id: vdbe.c,v 1.813 2009/02/01 00:29:57 drh Exp $
+** $Id: vdbe.c,v 1.814 2009/02/04 03:59:25 shane Exp $
 */
 #include "sqliteInt.h"
 #include "vdbeInt.h"
@@ -1228,7 +1228,8 @@ case OP_Remainder: {           /* same as TK_REM, in1, in2, out3 */
       case OP_Subtract:    b -= a;       break;
       case OP_Multiply:    b *= a;       break;
       case OP_Divide: {
-        if( a==0.0 ) goto arithmetic_result_is_null;
+        /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */
+        if( a==(double)0 ) goto arithmetic_result_is_null;
         b /= a;
         break;
       }
@@ -1873,7 +1874,7 @@ case OP_IfNot: {            /* jump, in1 */
     c = pOp->p3;
   }else{
 #ifdef SQLITE_OMIT_FLOATING_POINT
-    c = sqlite3VdbeIntValue(pIn1);
+    c = sqlite3VdbeIntValue(pIn1)!=0;
 #else
     c = sqlite3VdbeRealValue(pIn1)!=0.0;
 #endif
index 8f3c2b388a92e315533ecd3de3fa743dcbbe917e..d3274b5408ce96e0f7d6ad1c6a9012b45d46f950 100644 (file)
@@ -13,7 +13,7 @@
 ** This file contains code use to implement APIs that are part of the
 ** VDBE.
 **
-** $Id: vdbeapi.c,v 1.150 2008/12/10 18:03:47 drh Exp $
+** $Id: vdbeapi.c,v 1.151 2009/02/04 03:59:25 shane Exp $
 */
 #include "sqliteInt.h"
 #include "vdbeInt.h"
@@ -752,7 +752,8 @@ static Mem *columnMem(sqlite3_stmt *pStmt, int i){
     vals = sqlite3_data_count(pStmt);
     pOut = &pVm->pResultSet[i];
   }else{
-    static const Mem nullMem = {{0}, 0.0, 0, "", 0, MEM_Null, SQLITE_NULL, 0, 0, 0 };
+    /* ((double)0) In case of SQLITE_OMIT_FLOATING_POINT... */
+    static const Mem nullMem = {{0}, (double)0, 0, "", 0, MEM_Null, SQLITE_NULL, 0, 0, 0 };
     if( pVm->db ){
       sqlite3_mutex_enter(pVm->db->mutex);
       sqlite3Error(pVm->db, SQLITE_RANGE, 0);
index bd103245ed5dccf3ebcd759ceed88c7830382e6d..cc1ffc282d689fb0366ec18807dcd0275a930d20 100644 (file)
@@ -15,7 +15,7 @@
 ** only within the VDBE.  Interface routines refer to a Mem using the
 ** name sqlite_value
 **
-** $Id: vdbemem.c,v 1.136 2009/02/03 15:39:01 drh Exp $
+** $Id: vdbemem.c,v 1.137 2009/02/04 03:59:25 shane Exp $
 */
 #include "sqliteInt.h"
 #include "vdbeInt.h"
@@ -373,17 +373,20 @@ double sqlite3VdbeRealValue(Mem *pMem){
   }else if( pMem->flags & MEM_Int ){
     return (double)pMem->u.i;
   }else if( pMem->flags & (MEM_Str|MEM_Blob) ){
-    double val = 0.0;
+    /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */
+    double val = (double)0;
     pMem->flags |= MEM_Str;
     if( sqlite3VdbeChangeEncoding(pMem, SQLITE_UTF8)
        || sqlite3VdbeMemNulTerminate(pMem) ){
-      return 0.0;
+      /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */
+      return (double)0;
     }
     assert( pMem->z );
     sqlite3AtoF(pMem->z, &val);
     return val;
   }else{
-    return 0.0;
+    /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */
+    return (double)0;
   }
 }
 
@@ -969,7 +972,8 @@ int sqlite3ValueFromExpr(
   }else if( op==TK_UMINUS ) {
     if( SQLITE_OK==sqlite3ValueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal) ){
       pVal->u.i = -1 * pVal->u.i;
-      pVal->r = -1.0 * pVal->r;
+      /* (double)-1 In case of SQLITE_OMIT_FLOATING_POINT... */
+      pVal->r = (double)-1 * pVal->r;
     }
   }
 #ifndef SQLITE_OMIT_BLOB_LITERAL
index 5f10b81b0f975dedb2649997225976941ad30578..89e3f31e9461bdeb4196d7e4f7b00bfd70093061 100644 (file)
@@ -16,7 +16,7 @@
 ** so is applicable.  Because this module is responsible for selecting
 ** indices, you might also think of this module as the "query optimizer".
 **
-** $Id: where.c,v 1.367 2009/02/04 01:49:30 shane Exp $
+** $Id: where.c,v 1.368 2009/02/04 03:59:25 shane Exp $
 */
 #include "sqliteInt.h"
 
@@ -1547,7 +1547,8 @@ static double bestVirtualIndex(
                              + sizeof(*pIdxOrderBy)*nOrderBy );
     if( pIdxInfo==0 ){
       sqlite3ErrorMsg(pParse, "out of memory");
-      return 0.0;
+      /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */
+      return (double)0;
     }
     *ppIdxInfo = pIdxInfo;
 
@@ -1650,7 +1651,8 @@ static double bestVirtualIndex(
   pIdxInfo->idxNum = 0;
   pIdxInfo->needToFreeIdxStr = 0;
   pIdxInfo->orderByConsumed = 0;
-  pIdxInfo->estimatedCost = SQLITE_BIG_DBL / 2.0;
+  /* ((double)2) In case of SQLITE_OMIT_FLOATING_POINT... */
+  pIdxInfo->estimatedCost = SQLITE_BIG_DBL / ((double)2);
   nOrderBy = pIdxInfo->nOrderBy;
   if( pIdxInfo->nOrderBy && !orderByUsable ){
     *(int*)&pIdxInfo->nOrderBy = 0;
@@ -1679,7 +1681,8 @@ static double bestVirtualIndex(
     if( !pIdxInfo->aConstraint[i].usable && pUsage[i].argvIndex>0 ){
       sqlite3ErrorMsg(pParse, 
           "table %s: xBestIndex returned an invalid plan", pTab->zName);
-      return 0.0;
+      /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */
+      return (double)0;
     }
   }
 
@@ -3092,12 +3095,14 @@ WhereInfo *sqlite3WhereBegin(
           sCost.plan.wsFlags = WHERE_VIRTUALTABLE | WHERE_ORDERBY;
         }
         sCost.plan.nEq = 0;
-        if( (SQLITE_BIG_DBL/2.0)<sCost.rCost ){
+        /* (double)2 In case of SQLITE_OMIT_FLOATING_POINT... */
+        if( (SQLITE_BIG_DBL/((double)2))<sCost.rCost ){
           /* The cost is not allowed to be larger than SQLITE_BIG_DBL (the
           ** inital value of lowestCost in this loop. If it is, then
           ** the (cost<lowestCost) test below will never be true.
           */ 
-          sCost.rCost = (SQLITE_BIG_DBL/2.0);
+          /* (double)2 In case of SQLITE_OMIT_FLOATING_POINT... */
+          sCost.rCost = (SQLITE_BIG_DBL/((double)2));
         }
       }else 
 #endif
index e6d188e39ffd36216b6144f5c2e36560806c1739..1d624d7b13b9c88541f9004566cf18104cc35852 100644 (file)
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing expressions.
 #
-# $Id: expr.test,v 1.66 2008/12/30 17:55:00 drh Exp $
+# $Id: expr.test,v 1.67 2009/02/04 03:59:25 shane Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
 
 # Create a table to work with.
 #
-execsql {CREATE TABLE test1(i1 int, i2 int, r1 real, r2 real, t1 text, t2 text)}
-execsql {INSERT INTO test1 VALUES(1,2,1.1,2.2,'hello','world')}
+ifcapable floatingpoint {
+  execsql {CREATE TABLE test1(i1 int, i2 int, r1 real, r2 real, t1 text, t2 text)}
+  execsql {INSERT INTO test1 VALUES(1,2,1.1,2.2,'hello','world')}
+}
+ifcapable !floatingpoint {
+  execsql {CREATE TABLE test1(i1 int, i2 int, t1 text, t2 text)}
+  execsql {INSERT INTO test1 VALUES(1,2,'hello','world')}
+}
+
 proc test_expr {name settings expr result} {
   do_test $name [format {
     execsql {BEGIN; UPDATE test1 SET %s; SELECT %s FROM test1; ROLLBACK;}
@@ -47,8 +54,10 @@ test_expr expr-1.18 {i1=20, i2=20} {i2!=i1} 0
 test_expr expr-1.19 {i1=20, i2=20} {i2=i1} 1
 test_expr expr-1.20 {i1=20, i2=20} {i2<>i1} 0
 test_expr expr-1.21 {i1=20, i2=20} {i2==i1} 1
-test_expr expr-1.22 {i1=1, i2=2, r1=3.0} {i1+i2*r1} {7.0}
-test_expr expr-1.23 {i1=1, i2=2, r1=3.0} {(i1+i2)*r1} {9.0}
+ifcapable floatingpoint {
+  test_expr expr-1.22 {i1=1, i2=2, r1=3.0} {i1+i2*r1} {7.0}
+  test_expr expr-1.23 {i1=1, i2=2, r1=3.0} {(i1+i2)*r1} {9.0}
+}
 test_expr expr-1.24 {i1=1, i2=2} {min(i1,i2,i1+i2,i1-i2)} {-1}
 test_expr expr-1.25 {i1=1, i2=2} {max(i1,i2,i1+i2,i1-i2)} {3}
 test_expr expr-1.26 {i1=1, i2=2} {max(i1,i2,i1+i2,i1-i2)} {3}
@@ -134,48 +143,62 @@ test_expr expr-1.101 {i1=0, i2=''} {i1=i2} 0
 
 # Check for proper handling of 64-bit integer values.
 #
-test_expr expr-1.102 {i1=40, i2=1} {i2<<i1} 1099511627776
+if {[working_64bit_int]} {
+  test_expr expr-1.102 {i1=40, i2=1} {i2<<i1} 1099511627776
+}
 
-test_expr expr-1.103 {i1=0} {(-2147483648.0 % -1)} 0.0
-test_expr expr-1.104 {i1=0} {(-9223372036854775808.0 % -1)} 0.0
-test_expr expr-1.105 {i1=0} {(-9223372036854775808.0 / -1)>1} 1
+ifcapable floatingpoint {
+  test_expr expr-1.103 {i1=0} {(-2147483648.0 % -1)} 0.0
+  test_expr expr-1.104 {i1=0} {(-9223372036854775808.0 % -1)} 0.0
+  test_expr expr-1.105 {i1=0} {(-9223372036854775808.0 / -1)>1} 1
+}
+
+if {[working_64bit_int]} {
+  test_expr expr-1.106 {i1=0} {(1<<63)/-1} -9223372036854775808
+}
 
-test_expr expr-1.106 {i1=0} {(1<<63)/-1} -9223372036854775808
 test_expr expr-1.107 {i1=0} {(1<<63)%-1} 0
 test_expr expr-1.108 {i1=0} {1%0} {{}}
 test_expr expr-1.109 {i1=0} {1/0} {{}}
-test_expr expr-1.110 {i1=0} {-9223372036854775807/-1} 9223372036854775807
 
-test_expr expr-2.1 {r1=1.23, r2=2.34} {r1+r2} 3.57
-test_expr expr-2.2 {r1=1.23, r2=2.34} {r1-r2} -1.11
-test_expr expr-2.3 {r1=1.23, r2=2.34} {r1*r2} 2.8782
+if {[working_64bit_int]} {
+  test_expr expr-1.110 {i1=0} {-9223372036854775807/-1} 9223372036854775807
+}
+
+ifcapable floatingpoint {
+  test_expr expr-2.1 {r1=1.23, r2=2.34} {r1+r2} 3.57
+  test_expr expr-2.2 {r1=1.23, r2=2.34} {r1-r2} -1.11
+  test_expr expr-2.3 {r1=1.23, r2=2.34} {r1*r2} 2.8782
+}
 set tcl_precision 15
-test_expr expr-2.4 {r1=1.23, r2=2.34} {r1/r2} 0.525641025641026
-test_expr expr-2.5 {r1=1.23, r2=2.34} {r2/r1} 1.90243902439024
-test_expr expr-2.6 {r1=1.23, r2=2.34} {r2<r1} 0
-test_expr expr-2.7 {r1=1.23, r2=2.34} {r2<=r1} 0
-test_expr expr-2.8 {r1=1.23, r2=2.34} {r2>r1} 1
-test_expr expr-2.9 {r1=1.23, r2=2.34} {r2>=r1} 1
-test_expr expr-2.10 {r1=1.23, r2=2.34} {r2!=r1} 1
-test_expr expr-2.11 {r1=1.23, r2=2.34} {r2=r1} 0
-test_expr expr-2.12 {r1=1.23, r2=2.34} {r2<>r1} 1
-test_expr expr-2.13 {r1=1.23, r2=2.34} {r2==r1} 0
-test_expr expr-2.14 {r1=2.34, r2=2.34} {r2<r1} 0
-test_expr expr-2.15 {r1=2.34, r2=2.34} {r2<=r1} 1
-test_expr expr-2.16 {r1=2.34, r2=2.34} {r2>r1} 0
-test_expr expr-2.17 {r1=2.34, r2=2.34} {r2>=r1} 1
-test_expr expr-2.18 {r1=2.34, r2=2.34} {r2!=r1} 0
-test_expr expr-2.19 {r1=2.34, r2=2.34} {r2=r1} 1
-test_expr expr-2.20 {r1=2.34, r2=2.34} {r2<>r1} 0
-test_expr expr-2.21 {r1=2.34, r2=2.34} {r2==r1} 1
-test_expr expr-2.22 {r1=1.23, r2=2.34} {min(r1,r2,r1+r2,r1-r2)} {-1.11}
-test_expr expr-2.23 {r1=1.23, r2=2.34} {max(r1,r2,r1+r2,r1-r2)} {3.57}
-test_expr expr-2.24 {r1=25.0, r2=11.0} {r1%r2} 3.0
-test_expr expr-2.25 {r1=1.23, r2=NULL} {coalesce(r1+r2,99.0)} 99.0
-test_expr expr-2.26 {r1=1e300, r2=1e300} {coalesce((r1*r2)*0.0,99.0)} 99.0
-test_expr expr-2.26b {r1=1e300, r2=-1e300} {coalesce((r1*r2)*0.0,99.0)} 99.0
-test_expr expr-2.27 {r1=1.1, r2=0.0} {r1/r2} {{}}
-test_expr expr-2.28 {r1=1.1, r2=0.0} {r1%r2} {{}}
+ifcapable floatingpoint {
+  test_expr expr-2.4 {r1=1.23, r2=2.34} {r1/r2} 0.525641025641026
+  test_expr expr-2.5 {r1=1.23, r2=2.34} {r2/r1} 1.90243902439024
+  test_expr expr-2.6 {r1=1.23, r2=2.34} {r2<r1} 0
+  test_expr expr-2.7 {r1=1.23, r2=2.34} {r2<=r1} 0
+  test_expr expr-2.8 {r1=1.23, r2=2.34} {r2>r1} 1
+  test_expr expr-2.9 {r1=1.23, r2=2.34} {r2>=r1} 1
+  test_expr expr-2.10 {r1=1.23, r2=2.34} {r2!=r1} 1
+  test_expr expr-2.11 {r1=1.23, r2=2.34} {r2=r1} 0
+  test_expr expr-2.12 {r1=1.23, r2=2.34} {r2<>r1} 1
+  test_expr expr-2.13 {r1=1.23, r2=2.34} {r2==r1} 0
+  test_expr expr-2.14 {r1=2.34, r2=2.34} {r2<r1} 0
+  test_expr expr-2.15 {r1=2.34, r2=2.34} {r2<=r1} 1
+  test_expr expr-2.16 {r1=2.34, r2=2.34} {r2>r1} 0
+  test_expr expr-2.17 {r1=2.34, r2=2.34} {r2>=r1} 1
+  test_expr expr-2.18 {r1=2.34, r2=2.34} {r2!=r1} 0
+  test_expr expr-2.19 {r1=2.34, r2=2.34} {r2=r1} 1
+  test_expr expr-2.20 {r1=2.34, r2=2.34} {r2<>r1} 0
+  test_expr expr-2.21 {r1=2.34, r2=2.34} {r2==r1} 1
+  test_expr expr-2.22 {r1=1.23, r2=2.34} {min(r1,r2,r1+r2,r1-r2)} {-1.11}
+  test_expr expr-2.23 {r1=1.23, r2=2.34} {max(r1,r2,r1+r2,r1-r2)} {3.57}
+  test_expr expr-2.24 {r1=25.0, r2=11.0} {r1%r2} 3.0
+  test_expr expr-2.25 {r1=1.23, r2=NULL} {coalesce(r1+r2,99.0)} 99.0
+  test_expr expr-2.26 {r1=1e300, r2=1e300} {coalesce((r1*r2)*0.0,99.0)} 99.0
+  test_expr expr-2.26b {r1=1e300, r2=-1e300} {coalesce((r1*r2)*0.0,99.0)} 99.0
+  test_expr expr-2.27 {r1=1.1, r2=0.0} {r1/r2} {{}}
+  test_expr expr-2.28 {r1=1.1, r2=0.0} {r1%r2} {{}}
+}
 
 test_expr expr-3.1 {t1='abc', t2='xyz'} {t1<t2} 1
 test_expr expr-3.2 {t1='xyz', t2='abc'} {t1<t2} 0
@@ -233,17 +256,20 @@ test_expr expr-4.6 {t1='0.000', t2='0.0'} {t1==t2} 0
 test_expr expr-4.7 {t1=' 0.000', t2=' 0.0'} {t1==t2} 0
 test_expr expr-4.8 {t1='0.0', t2='abc'} {t1<t2} 1
 test_expr expr-4.9 {t1='0.0', t2='abc'} {t1==t2} 0
-test_expr expr-4.10 {r1='0.0', r2='abc'} {r1>r2} 0
-test_expr expr-4.11 {r1='abc', r2='Abc'} {r1<r2} 0
-test_expr expr-4.12 {r1='abc', r2='Abc'} {r1>r2} 1
-test_expr expr-4.13 {r1='abc', r2='Bbc'} {r1<r2} 0
-test_expr expr-4.14 {r1='abc', r2='Bbc'} {r1>r2} 1
-test_expr expr-4.15 {r1='0', r2='0.0'} {r1==r2} 1
-test_expr expr-4.16 {r1='0.000', r2='0.0'} {r1==r2} 1
-test_expr expr-4.17 {r1=' 0.000', r2=' 0.0'} {r1==r2} 0
-test_expr expr-4.18 {r1='0.0', r2='abc'} {r1<r2} 1
-test_expr expr-4.19 {r1='0.0', r2='abc'} {r1==r2} 0
-test_expr expr-4.20 {r1='0.0', r2='abc'} {r1>r2} 0
+
+ifcapable floatingpoint {
+  test_expr expr-4.10 {r1='0.0', r2='abc'} {r1>r2} 0
+  test_expr expr-4.11 {r1='abc', r2='Abc'} {r1<r2} 0
+  test_expr expr-4.12 {r1='abc', r2='Abc'} {r1>r2} 1
+  test_expr expr-4.13 {r1='abc', r2='Bbc'} {r1<r2} 0
+  test_expr expr-4.14 {r1='abc', r2='Bbc'} {r1>r2} 1
+  test_expr expr-4.15 {r1='0', r2='0.0'} {r1==r2} 1
+  test_expr expr-4.16 {r1='0.000', r2='0.0'} {r1==r2} 1
+  test_expr expr-4.17 {r1=' 0.000', r2=' 0.0'} {r1==r2} 0
+  test_expr expr-4.18 {r1='0.0', r2='abc'} {r1<r2} 1
+  test_expr expr-4.19 {r1='0.0', r2='abc'} {r1==r2} 0
+  test_expr expr-4.20 {r1='0.0', r2='abc'} {r1>r2} 0
+}
 
 # CSL is true if LIKE is case sensitive and false if not.
 # NCSL is the opposite.  Use these variables as the result
@@ -575,7 +601,9 @@ test_expr2 expr-7.36 {a<2 OR (a<0 OR b=0)} {{} 1}
 test_expr2 expr-7.37 {a<2 OR (b=0 OR a<0)} {{} 1}
 test_expr2 expr-7.38 {a<2 OR (a<0 AND b=0)} {1}
 test_expr2 expr-7.39 {a<2 OR (b=0 AND a<0)} {1}
-test_expr2 expr-7.40 {((a<2 OR a IS NULL) AND b<3) OR b>1e10} {{} 1}
+ifcapable floatingpoint {
+  test_expr2 expr-7.40 {((a<2 OR a IS NULL) AND b<3) OR b>1e10} {{} 1}
+}
 test_expr2 expr-7.41 {a BETWEEN -1 AND 1} {1}
 test_expr2 expr-7.42 {a NOT BETWEEN 2 AND 100} {1}
 test_expr2 expr-7.43 {(b+1234)||'this is a string that is at least 32 characters long' BETWEEN 1 AND 2} {}
@@ -614,23 +642,28 @@ test_expr2 expr-7.68 {b = abs(+-++-2)}                {1}
 test_expr2 expr-7.69 {b = abs(++++-2)}                {1}
 test_expr2 expr-7.70 {b = 5 - abs(+3)}                {1}
 test_expr2 expr-7.71 {b = 5 - abs(-3)}                {1}
-test_expr2 expr-7.72 {b = abs(-2.0)}                  {1}
+ifcapable floatingpoint {
+  test_expr2 expr-7.72 {b = abs(-2.0)}                  {1}
+}
 test_expr2 expr-7.73 {b = 6 - abs(-a)}                {2}
-test_expr2 expr-7.74 {b = abs(8.0)}                   {3}
-
+ifcapable floatingpoint {
+  test_expr2 expr-7.74 {b = abs(8.0)}                   {3}
+}
 
 # Test the CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP expressions.
 #
-set sqlite_current_time 1157124849
-do_test expr-8.1 {
-  execsql {SELECT CURRENT_TIME}
-} {15:34:09}
-do_test expr-8.2 {
-  execsql {SELECT CURRENT_DATE}
-} {2006-09-01}
-do_test expr-8.3 {
-  execsql {SELECT CURRENT_TIMESTAMP}
-} {{2006-09-01 15:34:09}}
+ifcapable {floatingpoint} {
+  set sqlite_current_time 1157124849
+  do_test expr-8.1 {
+    execsql {SELECT CURRENT_TIME}
+  } {15:34:09}
+  do_test expr-8.2 {
+    execsql {SELECT CURRENT_DATE}
+  } {2006-09-01}
+  do_test expr-8.3 {
+    execsql {SELECT CURRENT_TIMESTAMP}
+  } {{2006-09-01 15:34:09}}
+}
 ifcapable datetime {
   do_test expr-8.4 {
     execsql {SELECT CURRENT_TIME==time('now');}
@@ -644,9 +677,11 @@ ifcapable datetime {
 }
 set sqlite_current_time 0
 
-do_test expr-9.1 {
-  execsql {SELECT round(-('-'||'123'))}
-} 123.0
+ifcapable floatingpoint {
+  do_test expr-9.1 {
+    execsql {SELECT round(-('-'||'123'))}
+  } 123.0
+}
 
 # Test an error message that can be generated by the LIKE expression
 do_test expr-10.1 {
@@ -689,12 +724,14 @@ do_test expr-11.11 {
 do_test expr-11.12 {
   execsql {SELECT typeof(-00000009223372036854775808)}
 } {integer}
-do_test expr-11.13 {
-  execsql {SELECT typeof(-9223372036854775809)}
-} {real}
-do_test expr-11.14 {
-  execsql {SELECT typeof(-00000009223372036854775809)}
-} {real}
+ifcapable floatingpoint {
+  do_test expr-11.13 {
+    execsql {SELECT typeof(-9223372036854775809)}
+  } {real}
+  do_test expr-11.14 {
+    execsql {SELECT typeof(-00000009223372036854775809)}
+  } {real}
+}
 
 # These two statements used to leak memory (because of missing %destructor
 # directives in parse.y).
@@ -709,37 +746,43 @@ do_test expr-12.2 {
   }
 } {1 {near ")": syntax error}}
 
-do_test expr-13.1 {
-  execsql {
-    SELECT 12345678901234567890;
-  }
-} {1.23456789012346e+19}
+ifcapable floatingpoint {
+  do_test expr-13.1 {
+    execsql {
+      SELECT 12345678901234567890;
+    }
+  } {1.23456789012346e+19}
+}
 
 # Implicit String->Integer conversion is used when possible.
 #
-do_test expr-13.2 {
-  execsql {
-    SELECT 0+'9223372036854775807'
-  }
-} {9223372036854775807}
-do_test expr-13.3 {
-  execsql {
-    SELECT '9223372036854775807'+0
-  }
-} {9223372036854775807}
+if {[working_64bit_int]} {
+  do_test expr-13.2 {
+    execsql {
+      SELECT 0+'9223372036854775807'
+    }
+  } {9223372036854775807}
+  do_test expr-13.3 {
+    execsql {
+      SELECT '9223372036854775807'+0
+    }
+  } {9223372036854775807}
+}
 
 # If the value is too large, use String->Float conversion.
 #
-do_test expr-13.4 {
-  execsql {
-    SELECT 0+'9223372036854775808'
-  }
-} {9.22337203685478e+18}
-do_test expr-13.5 {
-  execsql {
-    SELECT '9223372036854775808'+0
-  }
-} {9.22337203685478e+18}
+ifcapable floatingpoint {
+  do_test expr-13.4 {
+    execsql {
+      SELECT 0+'9223372036854775808'
+    }
+  } {9.22337203685478e+18}
+  do_test expr-13.5 {
+    execsql {
+      SELECT '9223372036854775808'+0
+    }
+  } {9.22337203685478e+18}
+}
 
 # Use String->float conversion if the value is explicitly a floating
 # point value.
index 93c681831358d330a98267c34aa5b87c0df4089d..ae0f0174879e3dd94d02ab15d0028ca7e8f75dc7 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this file is testing built-in functions.
 #
-# $Id: func.test,v 1.90 2009/02/02 21:57:05 drh Exp $
+# $Id: func.test,v 1.91 2009/02/04 03:59:25 shane Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -149,24 +149,49 @@ do_test func-3.99 {
 
 # Test the abs() and round() functions.
 #
-do_test func-4.1 {
-  execsql {
-    CREATE TABLE t1(a,b,c);
-    INSERT INTO t1 VALUES(1,2,3);
-    INSERT INTO t1 VALUES(2,1.2345678901234,-12345.67890);
-    INSERT INTO t1 VALUES(3,-2,-5);
-  }
-  catchsql {SELECT abs(a,b) FROM t1}
-} {1 {wrong number of arguments to function abs()}}
+ifcapable !floatingpoint {
+  do_test func-4.1 {
+    execsql {
+      CREATE TABLE t1(a,b,c);
+      INSERT INTO t1 VALUES(1,2,3);
+      INSERT INTO t1 VALUES(2,12345678901234,-1234567890);
+      INSERT INTO t1 VALUES(3,-2,-5);
+    }
+    catchsql {SELECT abs(a,b) FROM t1}
+  } {1 {wrong number of arguments to function abs()}}
+}
+ifcapable floatingpoint {
+  do_test func-4.1 {
+    execsql {
+      CREATE TABLE t1(a,b,c);
+      INSERT INTO t1 VALUES(1,2,3);
+      INSERT INTO t1 VALUES(2,1.2345678901234,-12345.67890);
+      INSERT INTO t1 VALUES(3,-2,-5);
+    }
+    catchsql {SELECT abs(a,b) FROM t1}
+  } {1 {wrong number of arguments to function abs()}}
+}
 do_test func-4.2 {
   catchsql {SELECT abs() FROM t1}
 } {1 {wrong number of arguments to function abs()}}
-do_test func-4.3 {
-  catchsql {SELECT abs(b) FROM t1 ORDER BY a}
-} {0 {2 1.2345678901234 2}}
-do_test func-4.4 {
-  catchsql {SELECT abs(c) FROM t1 ORDER BY a}
-} {0 {3 12345.6789 5}}
+ifcapable floatingpoint {
+  do_test func-4.3 {
+    catchsql {SELECT abs(b) FROM t1 ORDER BY a}
+  } {0 {2 1.2345678901234 2}}
+  do_test func-4.4 {
+    catchsql {SELECT abs(c) FROM t1 ORDER BY a}
+  } {0 {3 12345.6789 5}}
+}
+ifcapable !floatingpoint {
+  if {[working_64bit_int]} {
+    do_test func-4.3 {
+      catchsql {SELECT abs(b) FROM t1 ORDER BY a}
+    } {0 {2 12345678901234 2}}
+  }
+  do_test func-4.4 {
+    catchsql {SELECT abs(c) FROM t1 ORDER BY a}
+  } {0 {3 1234567890 5}}
+}
 do_test func-4.4.1 {
   execsql {SELECT abs(a) FROM t2}
 } {1 {} 345 {} 67890}
@@ -174,40 +199,44 @@ do_test func-4.4.2 {
   execsql {SELECT abs(t1) FROM tbl1}
 } {0.0 0.0 0.0 0.0 0.0}
 
-do_test func-4.5 {
-  catchsql {SELECT round(a,b,c) FROM t1}
-} {1 {wrong number of arguments to function round()}}
-do_test func-4.6 {
-  catchsql {SELECT round(b,2) FROM t1 ORDER BY b}
-} {0 {-2.0 1.23 2.0}}
-do_test func-4.7 {
-  catchsql {SELECT round(b,0) FROM t1 ORDER BY a}
-} {0 {2.0 1.0 -2.0}}
-do_test func-4.8 {
-  catchsql {SELECT round(c) FROM t1 ORDER BY a}
-} {0 {3.0 -12346.0 -5.0}}
-do_test func-4.9 {
-  catchsql {SELECT round(c,a) FROM t1 ORDER BY a}
-} {0 {3.0 -12345.68 -5.0}}
-do_test func-4.10 {
-  catchsql {SELECT 'x' || round(c,a) || 'y' FROM t1 ORDER BY a}
-} {0 {x3.0y x-12345.68y x-5.0y}}
-do_test func-4.11 {
-  catchsql {SELECT round() FROM t1 ORDER BY a}
-} {1 {wrong number of arguments to function round()}}
-do_test func-4.12 {
-  execsql {SELECT coalesce(round(a,2),'nil') FROM t2}
-} {1.0 nil 345.0 nil 67890.0}
-do_test func-4.13 {
-  execsql {SELECT round(t1,2) FROM tbl1}
-} {0.0 0.0 0.0 0.0 0.0}
-do_test func-4.14 {
-  execsql {SELECT typeof(round(5.1,1));}
-} {real}
-do_test func-4.15 {
-  execsql {SELECT typeof(round(5.1));}
-} {real}
-
+ifcapable floatingpoint {
+  do_test func-4.5 {
+    catchsql {SELECT round(a,b,c) FROM t1}
+  } {1 {wrong number of arguments to function round()}}
+  do_test func-4.6 {
+    catchsql {SELECT round(b,2) FROM t1 ORDER BY b}
+  } {0 {-2.0 1.23 2.0}}
+  do_test func-4.7 {
+    catchsql {SELECT round(b,0) FROM t1 ORDER BY a}
+  } {0 {2.0 1.0 -2.0}}
+  do_test func-4.8 {
+    catchsql {SELECT round(c) FROM t1 ORDER BY a}
+  } {0 {3.0 -12346.0 -5.0}}
+  do_test func-4.9 {
+    catchsql {SELECT round(c,a) FROM t1 ORDER BY a}
+  } {0 {3.0 -12345.68 -5.0}}
+  do_test func-4.10 {
+    catchsql {SELECT 'x' || round(c,a) || 'y' FROM t1 ORDER BY a}
+  } {0 {x3.0y x-12345.68y x-5.0y}}
+  do_test func-4.11 {
+    catchsql {SELECT round() FROM t1 ORDER BY a}
+  } {1 {wrong number of arguments to function round()}}
+  do_test func-4.12 {
+    execsql {SELECT coalesce(round(a,2),'nil') FROM t2}
+  } {1.0 nil 345.0 nil 67890.0}
+  do_test func-4.13 {
+    execsql {SELECT round(t1,2) FROM tbl1}
+  } {0.0 0.0 0.0 0.0 0.0}
+  do_test func-4.14 {
+    execsql {SELECT typeof(round(5.1,1));}
+  } {real}
+  do_test func-4.15 {
+    execsql {SELECT typeof(round(5.1));}
+  } {real}
+  do_test func-4.16 {
+    catchsql {SELECT round(b,2.0) FROM t1 ORDER BY b}
+  } {0 {-2.0 1.23 2.0}}
+}
 
 # Test the upper() and lower() functions
 #
@@ -256,14 +285,26 @@ do_test func-7.1 {
 
 # Tests for aggregate functions and how they handle NULLs.
 #
-do_test func-8.1 {
-  ifcapable explain {
-    execsql {EXPLAIN SELECT sum(a) FROM t2;}
-  }
-  execsql {
-    SELECT sum(a), count(a), round(avg(a),2), min(a), max(a), count(*) FROM t2;
-  }
-} {68236 3 22745.33 1 67890 5}
+ifcapable floatingpoint {
+  do_test func-8.1 {
+    ifcapable explain {
+      execsql {EXPLAIN SELECT sum(a) FROM t2;}
+    }
+    execsql {
+      SELECT sum(a), count(a), round(avg(a),2), min(a), max(a), count(*) FROM t2;
+    }
+  } {68236 3 22745.33 1 67890 5}
+}
+ifcapable !floatingpoint {
+  do_test func-8.1 {
+    ifcapable explain {
+      execsql {EXPLAIN SELECT sum(a) FROM t2;}
+    }
+    execsql {
+      SELECT sum(a), count(a), avg(a), min(a), max(a), count(*) FROM t2;
+    }
+  } {68236 3 22745.0 1 67890 5}
+}
 do_test func-8.2 {
   execsql {
     SELECT max('z+'||a||'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP') FROM t2;
@@ -309,6 +350,7 @@ ifcapable compound {
                           UNION ALL SELECT -9223372036854775807)
     }
   } {real}
+ifcapable floatingpoint {
   do_test func-8.8 {
     execsql {
       SELECT sum(x)>0.0 FROM (SELECT '9223372036' || '854775808' AS x
@@ -316,6 +358,15 @@ ifcapable compound {
     }
   } {1}
 }
+ifcapable !floatingpoint {
+  do_test func-8.8 {
+    execsql {
+      SELECT sum(x)>0 FROM (SELECT '9223372036' || '854775808' AS x
+                          UNION ALL SELECT -9223372036850000000)
+    }
+  } {1}
+}
+}
 
 # How do you test the random() function in a meaningful, deterministic way?
 #
@@ -406,32 +457,35 @@ do_test func-10.3 {
     );
   }
 } {{}}
-do_test func-10.4 {
-  execsql {
-    SELECT testfunc(
-     'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
-     'double', 1.234
-    );
-  }
-} {1.234}
-do_test func-10.5 {
-  execsql {
-    SELECT testfunc(
-     'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
-     'int', 1234,
-     'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
-     'string', NULL,
-     'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
-     'double', 1.234,
-     'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
-     'int', 1234,
-     'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
-     'string', NULL,
-     'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
-     'double', 1.234
-    );
-  }
-} {1.234}
+
+ifcapable floatingpoint {
+  do_test func-10.4 {
+    execsql {
+      SELECT testfunc(
+       'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
+       'double', 1.234
+      );
+    }
+  } {1.234}
+  do_test func-10.5 {
+    execsql {
+      SELECT testfunc(
+       'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
+       'int', 1234,
+       'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
+       'string', NULL,
+       'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
+       'double', 1.234,
+       'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
+       'int', 1234,
+       'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
+       'string', NULL,
+       'string', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
+       'double', 1.234
+      );
+    }
+  } {1.234}
+}
 
 # Test the built-in sqlite_version(*) SQL function.
 #
@@ -610,12 +664,14 @@ do_test func-18.1 {
     SELECT sum(x) FROM t5;
   }
 } {9902}
-do_test func-18.2 {
-  execsql {
-    INSERT INTO t5 VALUES(0.0);
-    SELECT sum(x) FROM t5;
-  }
-} {9902.0}
+ifcapable floatingpoint {
+  do_test func-18.2 {
+    execsql {
+      INSERT INTO t5 VALUES(0.0);
+      SELECT sum(x) FROM t5;
+    }
+  } {9902.0}
+}
 
 # The sum of nothing is NULL.  But the sum of all NULLs is NULL.
 #
@@ -663,23 +719,39 @@ do_test func-18.11 {
     SELECT typeof(sum(x)) FROM t6
   }
 } integer
-do_test func-18.12 {
-  catchsql {
-    INSERT INTO t6 VALUES(1<<62);
-    SELECT sum(x) - ((1<<62)*2.0+1) from t6;
-  }
-} {1 {integer overflow}}
-do_test func-18.13 {
-  execsql {
-    SELECT total(x) - ((1<<62)*2.0+1) FROM t6
-  }
-} 0.0
-do_test func-18.14 {
-  execsql {
-    SELECT sum(-9223372036854775805);
-  }
-} -9223372036854775805
-
+ifcapable floatingpoint {
+  do_test func-18.12 {
+    catchsql {
+      INSERT INTO t6 VALUES(1<<62);
+      SELECT sum(x) - ((1<<62)*2.0+1) from t6;
+    }
+  } {1 {integer overflow}}
+  do_test func-18.13 {
+    execsql {
+      SELECT total(x) - ((1<<62)*2.0+1) FROM t6
+    }
+  } 0.0
+}
+ifcapable !floatingpoint {
+  do_test func-18.12 {
+    catchsql {
+      INSERT INTO t6 VALUES(1<<62);
+      SELECT sum(x) - ((1<<62)*2+1) from t6;
+    }
+  } {1 {integer overflow}}
+  do_test func-18.13 {
+    execsql {
+      SELECT total(x) - ((1<<62)*2+1) FROM t6
+    }
+  } 0.0
+}
+if {[working_64bit_int]} {
+  do_test func-18.14 {
+    execsql {
+      SELECT sum(-9223372036854775805);
+    }
+  } -9223372036854775805
+}
 ifcapable compound&&subquery {
 
 do_test func-18.15 {
@@ -689,20 +761,22 @@ do_test func-18.15 {
         SELECT 10 AS x);
   }
 } {1 {integer overflow}}
-do_test func-18.16 {
-  catchsql {
-    SELECT sum(x) FROM 
-       (SELECT 9223372036854775807 AS x UNION ALL
-        SELECT -10 AS x);
-  }
-} {0 9223372036854775797}
-do_test func-18.17 {
-  catchsql {
-    SELECT sum(x) FROM 
-       (SELECT -9223372036854775807 AS x UNION ALL
-        SELECT 10 AS x);
-  }
-} {0 -9223372036854775797}
+if {[working_64bit_int]} {
+  do_test func-18.16 {
+    catchsql {
+      SELECT sum(x) FROM 
+         (SELECT 9223372036854775807 AS x UNION ALL
+          SELECT -10 AS x);
+    }
+  } {0 9223372036854775797}
+  do_test func-18.17 {
+    catchsql {
+      SELECT sum(x) FROM 
+         (SELECT -9223372036854775807 AS x UNION ALL
+          SELECT 10 AS x);
+    }
+  } {0 -9223372036854775797}
+}
 do_test func-18.18 {
   catchsql {
     SELECT sum(x) FROM 
@@ -735,11 +809,13 @@ do_test func-18.22 {
 
 # Integer overflow on abs()
 #
-do_test func-18.31 {
-  catchsql {
-    SELECT abs(-9223372036854775807);
-  }
-} {0 9223372036854775807}
+if {[working_64bit_int]} {
+  do_test func-18.31 {
+    catchsql {
+      SELECT abs(-9223372036854775807);
+    }
+  } {0 9223372036854775807}
+}
 do_test func-18.32 {
   catchsql {
     SELECT abs(-9223372036854775807-1);