Skip to content

libMesh::isfinite() subroutines - #4521

Open
roystgnr wants to merge 9 commits into
libMesh:develfrom
roystgnr:is_finite
Open

libMesh::isfinite() subroutines#4521
roystgnr wants to merge 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.
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.

2 participants