Skip to content

Define floatmin, floatmax, maxintfloat and issubnormal for Dual instances - #855

Open
devmotion wants to merge 2 commits into
masterfrom
dw/dual-float-constants
Open

devmotion wants to merge 2 commits into
masterfrom
dw/dual-float-constants

Conversation

@devmotion

Copy link
Copy Markdown
Member

Fixes #852.

Following JuliaLang/julia#63451, typemin, typemax, floatmin, floatmax and maxintfloat accept instances as well as types. Base only forwards instances of AbstractFloat to the type methods, so floatmin(::Dual), floatmax(::Dual) and maxintfloat(::Dual) threw a MethodError. So did maxintfloat(::Type{<:Dual}) and issubnormal(::Dual).

These functions now return the primal, which is what eps already did, and they're defined together with eps in one loop. Before, typemin/typemax/floatmin/floatmax returned a Dual with zero partials, which only added overhead and could produce NaNs.

🤖 Generated with Claude Code

devmotion and others added 2 commits September 30, 2026 11:35
…ual` instances (#852)

`typemin`, `typemax`, `floatmin`, `floatmax` and `maxintfloat` now return
the primal for both `Dual` instances and types instead of a `Dual` with
zero partials, which only added overhead and could produce NaNs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@devmotion devmotion linked an issue Sep 30, 2026 that may be closed by this pull request
@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.21%. Comparing base (a3c0f4f) to head (b0d87da).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #855      +/-   ##
==========================================
- Coverage   91.23%   91.21%   -0.02%     
==========================================
  Files          11       11              
  Lines        1072     1070       -2     
==========================================
- Hits          978      976       -2     
  Misses         94       94              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

missing floatmin, floatmax, and issubnormal for Dual

1 participant