A more precise implementation of sqlite3RealToI64().

FossilOrigin-Name: 8813317cb52990d90bd48de163b6e35ddcad2b6f3187aa28b28e2e088b4489ce
This commit is contained in:
drh
2023-07-06 18:29:15 +00:00
parent 3e1e7aad3d
commit 68c88ea04f
3 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -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;
}