aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2023-07-06 18:29:15 +0000
committerdrh <>2023-07-06 18:29:15 +0000
commit68c88ea04fff77e8097c8a67db6b61b9ccab5b6f (patch)
treeda846158fc2c2afef341fe27337afe943de3f123 /src
parent3e1e7aad3d38553fa668c3866071a3d13aeaf766 (diff)
downloadsqlite-68c88ea04fff77e8097c8a67db6b61b9ccab5b6f.tar.gz
sqlite-68c88ea04fff77e8097c8a67db6b61b9ccab5b6f.zip
A more precise implementation of sqlite3RealToI64().
FossilOrigin-Name: 8813317cb52990d90bd48de163b6e35ddcad2b6f3187aa28b28e2e088b4489ce
Diffstat (limited to 'src')
-rw-r--r--src/vdbemem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vdbemem.c b/src/vdbemem.c
index fa29e9152..1250eea77 100644
--- a/src/vdbemem.c
+++ b/src/vdbemem.c
@@ -731,8 +731,8 @@ int sqlite3RealSameAsInt(double r1, sqlite3_int64 i){
** from UBSAN.
*/
i64 sqlite3RealToI64(double r){
- if( r<=(double)SMALLEST_INT64 ) return SMALLEST_INT64;
- if( r>=(double)LARGEST_INT64) return LARGEST_INT64;
+ if( r<-9223372036854774784.0 ) return SMALLEST_INT64;
+ if( r>+9223372036854774784.0 ) return LARGEST_INT64;
return (i64)r;
}