fixed result data type init

This commit is contained in:
myrrc 2020-12-17 21:33:51 +03:00
parent 1f67b0ce8d
commit ea2da764f6

View File

@ -990,7 +990,14 @@ public:
static constexpr const bool dec_a = IsDecimalNumber<T0>;
static constexpr const bool dec_b = IsDecimalNumber<T1>;
ResultDataType type = decimalResultType<is_multiply, is_division>(left, right);
ResultDataType type;
if constexpr(dec_a && IsFloatingPoint<RightDataType>)
type = RightDataType();
else if constexpr(dec_b && IsFloatingPoint<LeftDataType>)
type = LeftDataType();
else
type = decimalResultType<is_multiply, is_division>(left, right);
typename ResultDataType::FieldType scale_a = type.scaleFactorFor(left, is_multiply);
typename ResultDataType::FieldType scale_b = type.scaleFactorFor(right, is_multiply || is_division);