1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Implicit string->numeric conversion should go to an integer value when

possible.  Ticket #3257. (CVS 5502)

FossilOrigin-Name: da0e4bff30a77f72ae283406b547401c2ebb42c5
This commit is contained in:
drh
2008-07-30 13:27:10 +00:00
parent d63bd75987
commit 61669b3824
4 changed files with 53 additions and 10 deletions

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing expressions.
#
# $Id: expr.test,v 1.63 2008/07/15 00:27:35 drh Exp $
# $Id: expr.test,v 1.64 2008/07/30 13:27:11 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -703,4 +703,45 @@ do_test expr-13.1 {
}
} {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 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}
# Use String->float conversion if the value is explicitly a floating
# point value.
#
do_test expr-13.6 {
execsql {
SELECT 0+'9223372036854775807.0'
}
} {9.22337203685478e+18}
do_test expr-13.7 {
execsql {
SELECT '9223372036854775807.0'+0
}
} {9.22337203685478e+18}
finish_test