Skip to content

Commit

Permalink
Prevent overflow in Polynomial root-finding
Browse files Browse the repository at this point in the history
  • Loading branch information
David Legg authored and mattdailis committed Mar 1, 2024
1 parent c783a86 commit 8f9ebbd
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private Expiry findExpiryNearRoot(Predicate<Duration> expires) {

// Do a binary search to find the exact transition time
while (end.longerThan(start.plus(EPSILON))) {
Duration midpoint = start.plus(end).dividedBy(2);
Duration midpoint = start.plus(end.minus(start).dividedBy(2));
if (expires.test(midpoint)) {
end = midpoint;
} else {
Expand Down

0 comments on commit 8f9ebbd

Please sign in to comment.