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

Change the REAL-to-INTEGER casting behavior so that if the REAL value

is greater than 9223372036854775807.0 then it is cast to the latest
possible integer, 9223372036854775807.  This is sensible and the way
most platforms work in hardware.  The former behavior was that oversize
REALs would be cast to the smallest possible integer, -9223372036854775808,
which is the way Intel hardware works.

FossilOrigin-Name: 6f53fc7106658d44edf63068f9a8522fa5a7688b
This commit is contained in:
drh
2013-11-26 15:45:02 +00:00
parent dad19c3204
commit de1a8b8c69
7 changed files with 25 additions and 41 deletions

View File

@ -1606,14 +1606,14 @@ do_expr_test e_expr-31.1.4 { CAST(-0.99999 AS INTEGER) } integer 0
# an INTEGER then the result of the cast is the largest negative
# integer: -9223372036854775808.
#
do_expr_test e_expr-31.2.1 { CAST(2e+50 AS INT) } integer -9223372036854775808
do_expr_test e_expr-31.2.1 { CAST(2e+50 AS INT) } integer 9223372036854775807
do_expr_test e_expr-31.2.2 { CAST(-2e+50 AS INT) } integer -9223372036854775808
do_expr_test e_expr-31.2.3 {
CAST(-9223372036854775809.0 AS INT)
} integer -9223372036854775808
do_expr_test e_expr-31.2.4 {
CAST(9223372036854775809.0 AS INT)
} integer -9223372036854775808
} integer 9223372036854775807
# EVIDENCE-OF: R-09295-61337 Casting a TEXT or BLOB value into NUMERIC