llvm-project
f4941319 - [APFloat] Fix getExactInverse for DoubleAPFloat

Commit
120 days ago
[APFloat] Fix getExactInverse for DoubleAPFloat Some background: getExactInverse()'s callers expect that the result is not subnormal. DoubleAPFloat implemented getExactInverse() by going through semPPCDoubleDoubleLegacy. This means that numbers like 0x1p1022 which would have a normal inverse in semPPCDoubleDouble would not in semPPCDoubleDoubleLegacy. This commit refactors the logic into a single method on APFloat which uses getExactLog2Abs() and scalbn() to calculate the inverse without having to compute a reciprocal and test if it is inexact. This approach works for both IEEEFloat and DoubleAPFloat.
Author
Committer
Parents
Loading