mirror of https://github.com/sqlite/sqlite
Rename the experimental todouble() function to toreal(), update comments.
FossilOrigin-Name: 12c318ef1b674d1ef347458ce149398885f5ba10
This commit is contained in:
parent
ee1c64ed25
commit
bc3ec28b88
14
manifest
14
manifest
|
@ -1,5 +1,5 @@
|
|||
C Increase\sstrictness\sof\sthe\snew\sexperimental\sfunctions\sand\sadd\smore\stests.
|
||||
D 2013-03-12T09:07:25.371
|
||||
C Rename\sthe\sexperimental\stodouble()\sfunction\sto\storeal(),\supdate\scomments.
|
||||
D 2013-03-13T06:48:05.170
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 9a804abbd3cae82d196e4d33aba13239e32522a5
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
|
@ -133,7 +133,7 @@ F src/delete.c aeabdabeeeaa0584127f291baa9617153d334778
|
|||
F src/expr.c a23b4aac2a455b2e76b55bef5dcfbe62b665375c
|
||||
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
||||
F src/fkey.c e16942bd5c8a868ac53287886464a5ed0e72b179
|
||||
F src/func.c cdf7b604909be1feca6e928ceb4c511b79c085f3
|
||||
F src/func.c d83c67a1d247389af7ad8a4c05b3665027658a17
|
||||
F src/global.c e59ecd2c553ad0d4bfbc84ca71231336f8993a7a
|
||||
F src/hash.c ac3470bbf1ca4ae4e306a8ecb0fdf1731810ffe4
|
||||
F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970
|
||||
|
@ -511,7 +511,7 @@ F test/full.test 6b3c8fb43c6beab6b95438c1675374b95fab245d
|
|||
F test/func.test b058483c17952eff7797b837bbb61e27e6b05606
|
||||
F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f
|
||||
F test/func3.test 001021e5b88bd02a3b365a5c5fd8f6f49d39744a
|
||||
F test/func4.test 161f051a028d8347cdf044ba84b3cb353980b01f
|
||||
F test/func4.test cf09a622b456d3e2f33a3fb1a2be8eec7a8e35e2
|
||||
F test/fuzz-oss1.test 4912e528ec9cf2f42134456933659d371c9e0d74
|
||||
F test/fuzz.test 77fd50afc12847af50fcf1941679d90adebadde6
|
||||
F test/fuzz2.test 207d0f9d06db3eaf47a6b7bfc835b8e2fc397167
|
||||
|
@ -1038,7 +1038,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
|
|||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
|
||||
P f9468e334d6086b8a80c6a4204ec4e03fe59cf96
|
||||
R 4e552e5f44d1389ed4af9199ab9f91b5
|
||||
P 05c4463ec5f36dde50f6eb116624dc40142f2c8c
|
||||
R 64196e5fa6ca1fac5ad547b6cea78dab
|
||||
U mistachkin
|
||||
Z 362f229b782fa4883f52597e4e59d3e0
|
||||
Z b2ce5eefc524290638881e73eb677e9a
|
||||
|
|
|
@ -1 +1 @@
|
|||
05c4463ec5f36dde50f6eb116624dc40142f2c8c
|
||||
12c318ef1b674d1ef347458ce149398885f5ba10
|
12
src/func.c
12
src/func.c
|
@ -970,11 +970,11 @@ static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
|
|||
** change. This function may disappear. Do not write code that depends
|
||||
** on this function.
|
||||
**
|
||||
** Implementation of the TOINTEGER() function. This function takes a
|
||||
** Implementation of the tointeger() function. This function takes a
|
||||
** single argument. If the argument is an integer or is a double that
|
||||
** can be losslessly converted to an integer, the return value is the
|
||||
** same as the argument. If the argument is a double that cannot be
|
||||
** losslessly represented as an integer, the return value is undefined.
|
||||
** losslessly represented as an integer, the return value is NULL.
|
||||
** If the argument is NULL, the return value is NULL. Otherwise, an
|
||||
** attempt is made to convert the argument to an integer. If the
|
||||
** conversion is successful, the integer value is returned; otherwise,
|
||||
|
@ -1035,18 +1035,18 @@ static void tointegerFunc(
|
|||
** change. This function may disappear. Do not write code that depends
|
||||
** on this function.
|
||||
**
|
||||
** Implementation of the TODOUBLE() function. This function takes a
|
||||
** Implementation of the toreal() function. This function takes a
|
||||
** single argument. If the argument is a double or is an integer that
|
||||
** can be losslessly converted to a double, the return value is the
|
||||
** same as the argument. If the argument is an integer that cannot be
|
||||
** losslessly represented as a double, the return value is undefined.
|
||||
** losslessly represented as a double, the return value is NULL.
|
||||
** If the argument is NULL, the return value is NULL. Otherwise, an
|
||||
** attempt is made to convert the argument to a double. If the
|
||||
** conversion is successful, the double value is returned; otherwise,
|
||||
** NULL is returned.
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_FLOATING_POINT
|
||||
static void todoubleFunc(
|
||||
static void torealFunc(
|
||||
sqlite3_context *context,
|
||||
int argc,
|
||||
sqlite3_value **argv
|
||||
|
@ -1803,7 +1803,7 @@ void sqlite3RegisterGlobalFunctions(void){
|
|||
FUNCTION(quote, 1, 0, 0, quoteFunc ),
|
||||
FUNCTION(tointeger, 1, 0, 0, tointegerFunc ),
|
||||
#ifndef SQLITE_OMIT_FLOATING_POINT
|
||||
FUNCTION(todouble, 1, 0, 0, todoubleFunc ),
|
||||
FUNCTION(toreal, 1, 0, 0, torealFunc ),
|
||||
#endif
|
||||
FUNCTION(last_insert_rowid, 0, 0, 0, last_insert_rowid),
|
||||
FUNCTION(changes, 0, 0, 0, changes ),
|
||||
|
|
102
test/func4.test
102
test/func4.test
|
@ -9,7 +9,7 @@
|
|||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the TOINTEGER() and TODOUBLE()
|
||||
# focus of this file is testing the tointeger() and toreal()
|
||||
# functions.
|
||||
#
|
||||
set testdir [file dirname $argv0]
|
||||
|
@ -167,151 +167,151 @@ do_execsql_test func4-1.[incr i] {
|
|||
ifcapable floatingpoint {
|
||||
set i 0
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(NULL);
|
||||
SELECT toreal(NULL);
|
||||
} {{}}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble('');
|
||||
SELECT toreal('');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(' ');
|
||||
SELECT toreal(' ');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble('1234');
|
||||
SELECT toreal('1234');
|
||||
} {1234.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(' 1234');
|
||||
SELECT toreal(' 1234');
|
||||
} {1234.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble('bad');
|
||||
SELECT toreal('bad');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble('0xBAD');
|
||||
SELECT toreal('0xBAD');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble('123BAD');
|
||||
SELECT toreal('123BAD');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble('0x123BAD');
|
||||
SELECT toreal('0x123BAD');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble('123NO');
|
||||
SELECT toreal('123NO');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble('0x123NO');
|
||||
SELECT toreal('0x123NO');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble('-0x1');
|
||||
SELECT toreal('-0x1');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble('-0x0');
|
||||
SELECT toreal('-0x0');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble('0x0');
|
||||
SELECT toreal('0x0');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble('0x1');
|
||||
SELECT toreal('0x1');
|
||||
} {{}}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(-1);
|
||||
SELECT toreal(-1);
|
||||
} {-1.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(-0);
|
||||
SELECT toreal(-0);
|
||||
} {0.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(0);
|
||||
SELECT toreal(0);
|
||||
} {0.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(1);
|
||||
SELECT toreal(1);
|
||||
} {1.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(-1.79769313486232e308 - 1);
|
||||
SELECT toreal(-1.79769313486232e308 - 1);
|
||||
} {-Inf}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(-1.79769313486232e308);
|
||||
SELECT toreal(-1.79769313486232e308);
|
||||
} {-Inf}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(-1.79769313486232e308 + 1);
|
||||
SELECT toreal(-1.79769313486232e308 + 1);
|
||||
} {-Inf}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(-9223372036854775808 - 1);
|
||||
SELECT toreal(-9223372036854775808 - 1);
|
||||
} {-9.22337203685478e+18}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(-9223372036854775808);
|
||||
SELECT toreal(-9223372036854775808);
|
||||
} {-9.22337203685478e+18}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(-9223372036854775808 + 1);
|
||||
SELECT toreal(-9223372036854775808 + 1);
|
||||
} {-9.22337203685478e+18}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(-2147483648 - 1);
|
||||
SELECT toreal(-2147483648 - 1);
|
||||
} {-2147483649.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(-2147483648);
|
||||
SELECT toreal(-2147483648);
|
||||
} {-2147483648.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(-2147483648 + 1);
|
||||
SELECT toreal(-2147483648 + 1);
|
||||
} {-2147483647.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(2147483647 - 1);
|
||||
SELECT toreal(2147483647 - 1);
|
||||
} {2147483646.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(2147483647);
|
||||
SELECT toreal(2147483647);
|
||||
} {2147483647.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(2147483647 + 1);
|
||||
SELECT toreal(2147483647 + 1);
|
||||
} {2147483648.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(9223372036854775807 - 1);
|
||||
SELECT toreal(9223372036854775807 - 1);
|
||||
} {9.22337203685478e+18}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(9223372036854775807);
|
||||
SELECT toreal(9223372036854775807);
|
||||
} {9.22337203685478e+18}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(9223372036854775807 + 1);
|
||||
SELECT toreal(9223372036854775807 + 1);
|
||||
} {9.22337203685478e+18}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(1.79769313486232e308 - 1);
|
||||
SELECT toreal(1.79769313486232e308 - 1);
|
||||
} {Inf}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(1.79769313486232e308);
|
||||
SELECT toreal(1.79769313486232e308);
|
||||
} {Inf}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(1.79769313486232e308 + 1);
|
||||
SELECT toreal(1.79769313486232e308 + 1);
|
||||
} {Inf}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(4503599627370496 - 1);
|
||||
SELECT toreal(4503599627370496 - 1);
|
||||
} {4503599627370500.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(4503599627370496);
|
||||
SELECT toreal(4503599627370496);
|
||||
} {4503599627370500.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(4503599627370496 + 1);
|
||||
SELECT toreal(4503599627370496 + 1);
|
||||
} {4503599627370500.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(9007199254740992 - 1);
|
||||
SELECT toreal(9007199254740992 - 1);
|
||||
} {9007199254740990.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(9007199254740992);
|
||||
SELECT toreal(9007199254740992);
|
||||
} {9007199254740990.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(9007199254740992 + 1);
|
||||
SELECT toreal(9007199254740992 + 1);
|
||||
} {9007199254740990.0}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(9223372036854775808 - 1);
|
||||
SELECT toreal(9223372036854775808 - 1);
|
||||
} {9.22337203685478e+18}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(9223372036854775808);
|
||||
SELECT toreal(9223372036854775808);
|
||||
} {9.22337203685478e+18}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(9223372036854775808 + 1);
|
||||
SELECT toreal(9223372036854775808 + 1);
|
||||
} {9.22337203685478e+18}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(18446744073709551616 - 1);
|
||||
SELECT toreal(18446744073709551616 - 1);
|
||||
} {1.84467440737096e+19}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(18446744073709551616);
|
||||
SELECT toreal(18446744073709551616);
|
||||
} {1.84467440737096e+19}
|
||||
do_execsql_test func4-2.[incr i] {
|
||||
SELECT todouble(18446744073709551616 + 1);
|
||||
SELECT toreal(18446744073709551616 + 1);
|
||||
} {1.84467440737096e+19}
|
||||
}
|
||||
|
||||
|
@ -400,7 +400,7 @@ ifcapable check {
|
|||
set i 0
|
||||
do_execsql_test func4-4.[incr i] {
|
||||
CREATE TABLE t2(
|
||||
x REAL CHECK(todouble(x) IS NOT NULL)
|
||||
x REAL CHECK(toreal(x) IS NOT NULL)
|
||||
);
|
||||
} {}
|
||||
do_test func4-4.[incr i] {
|
||||
|
|
Loading…
Reference in New Issue