[llvm] [APFloat] Fix literals with long significands. (PR #102051)
Jakub Kuderski via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 3 13:26:30 PDT 2024
================
@@ -2950,18 +2956,21 @@ IEEEFloat::opStatus
IEEEFloat::roundSignificandWithExponent(const integerPart *decSigParts,
unsigned sigPartCount, int exp,
roundingMode rounding_mode) {
- unsigned int parts, pow5PartCount;
- fltSemantics calcSemantics = { 32767, -32767, 0, 0 };
- integerPart pow5Parts[maxPowerOfFiveParts];
+ unsigned int parts;
+ fltSemantics calcSemantics = {std::numeric_limits<ExponentType>::max(),
+ std::numeric_limits<ExponentType>::min(), 0, 0};
bool isNearest;
isNearest = (rounding_mode == rmNearestTiesToEven ||
rounding_mode == rmNearestTiesToAway);
parts = partCountForBits(semantics->precision + 11);
+ // Make sure that abs(exp) is representable.
+ assert(exp > INT_MIN);
----------------
kuhar wrote:
Also prefer `std::numeric_limits`
https://github.com/llvm/llvm-project/pull/102051
More information about the llvm-commits
mailing list