Skip to content

libMesh::isfinite() subroutines - #4521

Merged
roystgnr merged 9 commits into
libMesh:develfrom
roystgnr:is_finite
Aug 13, 2026
Merged

libMesh::isfinite() subroutines#4521
roystgnr merged 9 commits into
libMesh:develfrom
roystgnr:is_finite

Conversation

@roystgnr

Copy link
Copy Markdown
Member

From idaholab/moose#33439 (comment):

in the longer term maybe should be a class method on TypeVector. What do you think @roystgnr ?

I think it should be a global method so future generic code can use the same isfinite(foo) and get std::isfinite via a using or libMesh::isfinite via ADL, but otherwise I agree.

@lindsayad - we should probably be adding isfinite to MetaPhysicL too, and isnan here, don't you think? More urgently the former? I think long ago I got into the habit of using isnan in cases which in hindsight should have been isnan 20% of the time and isfinite 80% of the time, simply because I formed that habit pre-C++11.

@roystgnr
roystgnr requested a review from lindsayad August 11, 2026 22:45
You'd think std::isfinite would already support std::complex, right?
But apparently the idea only got floated once back in 2022, the C++
people want to see it in C _Complex first, and I can't find a C
equivalent to the C++ std-proposals mailing list so I'm not sure where
it went from there.
Surely they can't blame *this* lacuna on the C people.
@lindsayad

Copy link
Copy Markdown
Member

@lindsayad - we should probably be adding isfinite to MetaPhysicL too, and isnan here, don't you think? More urgently the former?

Yea agree!

Fixing our failure to test complex instantiations with Number!=complex
uncovered the fact that we didn't actually have test macros that work
for Number!=complex
I should probably be less lazy and make something that templates on type
and avoids all the "yup, 0i=0i" testing in the real-valued cases, but
these are very fast tests anyway.
@moosebuild

Copy link
Copy Markdown

Job Coverage, step Generate coverage on 694f880 wanted to post the following:

Coverage

93e23a #4521 694f88
Total Total +/- New
Rate 65.94% 65.93% -0.00% -
Hits 79390 79388 -2 0
Misses 41016 41018 +2 0

Diff coverage report

Full coverage report

This comment will be updated on new commits.

@lindsayad lindsayad left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@roystgnr
roystgnr merged commit 88337d3 into libMesh:devel Aug 13, 2026
23 checks passed
@roystgnr
roystgnr deleted the is_finite branch August 13, 2026 02:30
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.

3 participants