Skip to content

stop clipping rejected steps to t1#758

Merged
patrick-kidger merged 1 commit into
patrick-kidger:mainfrom
jpbrodrick89:jpb/fix-inifinie-clip-reject-loop
Jun 2, 2026
Merged

stop clipping rejected steps to t1#758
patrick-kidger merged 1 commit into
patrick-kidger:mainfrom
jpbrodrick89:jpb/fix-inifinie-clip-reject-loop

Conversation

@jpbrodrick89
Copy link
Copy Markdown
Contributor

_clip_to_end previously overrode the PID controller on a rejected step with a fixed midpoint that is also rejected; on rejection tprev doesn't advance, so the midpoint is constant, and the same too-large step gets retried forever.

The midpoint override's only justification was floating-point stability of dense interpolation against the old fixed 1e-6 tolerance. #660 replaced that with 100 * ULP(t1), which is directly related to the float resolution boundary. This PR just drops that branch and trusts the controller's shrunken proposal on rejection. The #85 fix (only snap-to-t1 on accepted steps) is preserved.

Regression coverage:

  • _clip_to_end unit test pinning the three branches directly.
  • End-to-end test: harmonic oscillator at t1=600 in float32 with rtol=1e-4 deterministically hangs at the clip floor (final_t ≈ 599.9937) on main and finishes in ~30 steps with this patch.

@patrick-kidger patrick-kidger merged commit 2cd9890 into patrick-kidger:main Jun 2, 2026
2 checks passed
@patrick-kidger
Copy link
Copy Markdown
Owner

LGTM! Merged 🎉

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.

Infinite final-step rejection loop due to conflicting endpoint clipping and adaptative RK step rejection

2 participants