Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions flang/lib/Evaluate/int-power.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ ValueWithRealFlags<REAL> TimesIntPowerOf(const REAL &factor, const REAL &base,
REAL squares{base};
int nbits{INT::bits - absPower.LEADZ()};
for (int j{0}; j < nbits; ++j) {
if (j > 0) { // avoid spurious overflow on last iteration
squares =
squares.Multiply(squares, rounding).AccumulateFlags(result.flags);
}
if (absPower.BTEST(j)) {
if (negativePower) {
result.value = result.value.Divide(squares, rounding)
Expand All @@ -42,8 +46,6 @@ ValueWithRealFlags<REAL> TimesIntPowerOf(const REAL &factor, const REAL &base,
.AccumulateFlags(result.flags);
}
}
squares =
squares.Multiply(squares, rounding).AccumulateFlags(result.flags);
}
}
return result;
Expand Down