Skip to content

Commit

Permalink
Update cpp/src/arrow/util/decimal.cc
Browse files Browse the repository at this point in the history
Co-authored-by: Antoine Pitrou <[email protected]>
  • Loading branch information
zeroshade and pitrou committed Sep 30, 2024
1 parent ced9b47 commit 404921f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cpp/src/arrow/util/decimal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ struct DecimalRealConversion : public BaseDecimalRealConversion {
return OverflowError(real, precision, scale);
}

// The algorithm below requires the destination decimal type
// to be strictly more precise than the source float type
// (see `kSafeMulByTenTo` calculation).
if constexpr (kMaxPrecision <= kMantissaDigits) {
return Derived::FromPositiveRealApprox(real, precision, scale);
}
Expand Down

0 comments on commit 404921f

Please sign in to comment.