-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
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
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
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
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
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
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
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
-6301f08a2b32289a49c4af994f2770318c444b49
\ No newline at end of file
+5cef400023205b55152b91441acc78f9cd8d58a9
\ No newline at end of file
** 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
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;
** 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"
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);
** 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>
/*
** 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;
sqlite3AtoF(zBuf, &r);
sqlite3_result_double(context, r);
}
+#endif
/*
** Allocate nByte bytes of space using sqlite3_malloc(). If the
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);
}
/*
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 ),
** 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"
** 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;
memcpy(&y, &x, 8);
assert( sqlite3IsNaN(y) );
}
+#endif
#endif
return rc;
**
** 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 */
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
/* 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);
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;
** 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.
*/
** 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"
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;
}
c = pOp->p3;
}else{
#ifdef SQLITE_OMIT_FLOATING_POINT
- c = sqlite3VdbeIntValue(pIn1);
+ c = sqlite3VdbeIntValue(pIn1)!=0;
#else
c = sqlite3VdbeRealValue(pIn1)!=0.0;
#endif
** 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"
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);
** 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"
}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;
}
}
}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
** 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"
+ 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;
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;
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;
}
}
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
# 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;}
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}
# 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
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
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} {}
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');}
}
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 {
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).
}
} {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.
# 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
# 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}
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
#
# 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;
UNION ALL SELECT -9223372036854775807)
}
} {real}
+ifcapable floatingpoint {
do_test func-8.8 {
execsql {
SELECT sum(x)>0.0 FROM (SELECT '9223372036' || '854775808' AS x
}
} {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?
#
);
}
} {{}}
-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.
#
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.
#
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 {
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
# 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);