This commit is contained in:
zvonand 2022-07-25 10:47:07 +02:00
parent 3fb3015375
commit 5ff77e3b5f

View File

@ -292,7 +292,11 @@ inline auto binaryOpResult(const DecimalType<T> & tx, const DecimalType<U> & ty)
if constexpr (is_multiply)
scale = tx.getScale() + ty.getScale();
else if constexpr (is_division)
{
scale = tx.getScale();
if (scale * 2 > max_precision<T>)
throw Exception("Overflow during decimal division", ErrorCodes::DECIMAL_OVERFLOW);
}
else
scale = (tx.getScale() > ty.getScale() ? tx.getScale() : ty.getScale());