1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-21 11:13:54 +03:00

Avoid 32-bit roundoff error on the second argument to round().

[forum:/forumpost/170aeab92a|Forum post 170aeab92a].

FossilOrigin-Name: a9759fc78d6cb0df7c81f20c2c5c358729e571ebee50ee2b1441a15239d0b4b6
This commit is contained in:
drh
2024-12-18 18:29:19 +00:00
parent 0c34eab477
commit 47bc07d425
4 changed files with 14 additions and 11 deletions

View File

@@ -440,13 +440,13 @@ static void substrFunc(
*/
#ifndef SQLITE_OMIT_FLOATING_POINT
static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
int n = 0;
i64 n = 0;
double r;
char *zBuf;
assert( argc==1 || argc==2 );
if( argc==2 ){
if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return;
n = sqlite3_value_int(argv[1]);
n = sqlite3_value_int64(argv[1]);
if( n>30 ) n = 30;
if( n<0 ) n = 0;
}