Skip to content

Make solve_itp epsilon more robust - #609

Open
raphlinus wants to merge 2 commits into
mainfrom
itp_fix
Open

raphlinus wants to merge 2 commits into
mainfrom
itp_fix

Conversation

@raphlinus

Copy link
Copy Markdown
Contributor

Enforce a minimum epsilon of f64::EPSILON times the bracket magnitude, so the resulting tolerance is representable in floating point precision. That bounds nmax so the shift can't overflow. Also clamp r so that it can't become negative, which otherwise can happen because of float precision and can cause an infinite loop.

A couple of tweaks to accuracy for eval_arc (in fit.rs) and inv_arclen, avoiding unreasonably small epsilon values (which triggered the original failures) without meaningfully degrading overall accuracy.

Adds some regression tests which previously failed. In addition to the tests added in the PR, I've also (with some LLM help) verified against repros in the three linked reports and some additional adversarial testing.

This was based on analysis and proposed fixes from #588 by @greysquirr3l, #600 by @kooshi, and #602 by @mlwilkerson. Many thanks to the original submitters.

Closes #602 and supersedes #588 and #600

Enforce a minimum epsilon of f64::EPSILON times the bracket magnitude, so the
resulting tolerance is representable in floating point precision. That bounds
nmax so the shift can't overflow. Also clamp r so that it can't become
negative, which otherwise can happen because of float precision and can cause
an infinite loop.

A couple of tweaks to accuracy for eval_arc (in fit.rs) and inv_arclen,
avoiding unreasonably small epsilon values (which triggered the original
failures) without meaningfully degrading overall accuracy.

Adds some regression tests which previously failed. In addition to the tests
added in the PR, I've also (with some LLM help) verified against repros in the
three linked reports and some additional adversarial testing.

This was based on analysis and proposed fixes from #588 by @greysquirr3l, #600
by @kooshi, and #602 by @mlwilkerson. Many thanks to the original submitters.

Closes #602 and supersedes #588 and #600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fit_to_bezpath_opt hangs forever in release builds

1 participant