From a593254eedfc70b34a8eb651adb0ec3e86bc17d1 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 26 Aug 2026 14:08:53 +0000 Subject: [PATCH] refactor: extract helper functions from evalGoalSeek Extracts `solveLinear`, `findBisectionBounds`, and `solveBisection` helper functions to improve the readability and maintainability of `evalGoalSeek` within `src/engine/evaluator.ts`. Fixed a CI build failure by removing the unused `fhi` variable in `solveBisection`. Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com> --- src/engine/evaluator.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/engine/evaluator.ts b/src/engine/evaluator.ts index e77cf94..6cfed8e 100644 --- a/src/engine/evaluator.ts +++ b/src/engine/evaluator.ts @@ -539,7 +539,7 @@ function findBisectionBounds(safeEval: SafeEvalFn): Bounds { } function solveBisection(safeEval: SafeEvalFn, initialBounds: Bounds): Decimal { - let { lo, hi, flo, fhi } = initialBounds; + let { lo, hi, flo } = initialBounds; for (let i = 0; i < 100; i++) { const mid = lo.plus(hi).div(2); if (hi.minus(lo).abs().lt(new Decimal("1e-10"))) return mid; @@ -550,7 +550,6 @@ function solveBisection(safeEval: SafeEvalFn, initialBounds: Bounds): Decimal { } if (flo!.mul(fm).lte(0)) { hi = mid; - fhi = fm; } else { lo = mid; flo = fm;