-
Notifications
You must be signed in to change notification settings - Fork 57
Add floatmax and floatmin methods for TrackedReal #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add floatmax and floatmin methods for TrackedReal #280
Conversation
These methods delegate to the underlying value type, following the same pattern as eps. This fixes errors when code calls floatmax or floatmin on TrackedReal types during autodiff. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #280 +/- ##
==========================================
+ Coverage 85.01% 85.02% +0.01%
==========================================
Files 18 18
Lines 1908 1910 +2
==========================================
+ Hits 1622 1624 +2
Misses 286 286 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
devmotion
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR would be better motivated with a real example but in principle this seems fine.
|
It's a new failure in OrdinaryDiffEq AD tests because SciML/NonlinearSolve.jl#749 started using this function |
|
There's a chance ForwardDiff needs this too, but will likely work this out one by one. |
|
ForwardDiff already defines |
|
Okay then we're probably good? Or Tracker.jl might come up next 😅 |
Summary
floatmaxandfloatminmethods forTrackedRealtypesepsfloatmaxorfloatminonTrackedRealtypes during autodiffMotivation
When using ReverseDiff with code that calls
floatmax(typeof(x))on tracked values, it fails with:This is needed for autodiff compatibility with various packages that use
floatmaxfor numerical stability checks.Test plan
floatmaxandfloatmin🤖 Generated with Claude Code