1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Fix(MCOL-4611): mod loses precision on huge narrow decimal (#3473)

This commit is contained in:
Akhmad Oripov
2025-03-31 15:59:40 +02:00
committed by GitHub
parent 848f5bf162
commit 1bcf63a436
4 changed files with 47 additions and 2 deletions

View File

@ -106,7 +106,7 @@ IDB_Decimal Func_mod::getDecimalVal(Row& row, FunctionParm& parm, bool& isNull,
}
IDB_Decimal d = parm[0]->data()->getDecimalVal(row, isNull);
int64_t value = d.value / pow(10.0, d.scale);
int64_t value = d.value / static_cast<int64_t>(pow(10.0, d.scale));
int lefto = d.value % (int)pow(10.0, d.scale);
int64_t mod = (value % div) * pow(10.0, d.scale) + lefto;

View File

@ -381,7 +381,7 @@ class Func_mod : public Func_Real
return static_cast<ModType>(integralRemainder.toTFloat128() + intAndFract.second);
}
}
int64_t value = d.value / pow(10.0, d.scale);
int64_t value = d.value / static_cast<int64_t>(pow(10.0, d.scale));
return value % div;
}
};