1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +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

@@ -3514,7 +3514,9 @@ case OP_SeekGt: { /* jump, in3 */
** point number. */
assert( (pIn3->flags & MEM_Real)!=0 );
if( iKey==SMALLEST_INT64 && (pIn3->r<(double)iKey || pIn3->r>0) ){
if( (iKey==SMALLEST_INT64 && pIn3->r<(double)iKey)
|| (iKey==LARGEST_INT64 && pIn3->r>(double)iKey)
){
/* The P3 value is too large in magnitude to be expressed as an
** integer. */
res = 1;