Skip to content

Always specialize std::numeric_limits for DualNumber - #80

Open
GiudGiud wants to merge 1 commit into
libMesh:masterfrom
GiudGiud:PR_eps_ad
Open

Always specialize std::numeric_limits for DualNumber#80
GiudGiud wants to merge 1 commit into
libMesh:masterfrom
GiudGiud:PR_eps_ad

Conversation

@GiudGiud

@GiudGiud GiudGiud commented Sep 11, 2026

Copy link
Copy Markdown

refs roystogner/metaphyscl#91

The DualNumber numeric_limits specialization was only placed in namespace std under METAPHYSICL_ENABLE_STD_VIOLATION, which defaults to off. Without it, std::numeric_limits fell back to the primary template, whose epsilon() value-initializes to a zero DualNumber. Specializing std::numeric_limits for a program-defined type is explicitly permitted by the standard, so provide it unconditionally (guarded against duplication when the std-violation path already defines it).

refs roystogner/metaphyscl#91

The DualNumber numeric_limits specialization was only placed in namespace
std under METAPHYSICL_ENABLE_STD_VIOLATION, which defaults to off. Without
it, std::numeric_limits<ADReal> fell back to the primary template, whose
epsilon() value-initializes to a zero DualNumber. Specializing
std::numeric_limits for a program-defined type is explicitly permitted by
the standard, so provide it unconditionally (guarded against duplication
when the std-violation path already defines it).

Co-Authored-By: Claude <noreply@anthropic.com>
@GiudGiud

Copy link
Copy Markdown
Author

@roystgnr

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.

1 participant