Skip to content

Commit

Permalink
Caps output lsb for the inverse function
Browse files Browse the repository at this point in the history
  • Loading branch information
Agathe Herrou authored and sletz committed Dec 12, 2023
1 parent 6852814 commit 8b13356
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler/interval/intervalInv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ interval interval_algebra::Inv(const interval& x)
if (precision == INT_MIN or taylor_lsb)
precision = floor(x.lsb() - 2*log2(abs(v))); // 1/(x+u) - 1/x = -u/x^2 + o(u)

precision = std::max(precision, -31);

if ((x.hi() < 0) || (x.lo() >= 0)) {
return {1.0 / x.hi(), 1.0 / x.lo(), precision};
}
Expand Down

0 comments on commit 8b13356

Please sign in to comment.