Skip to content

Commit 0cbbf54

Browse files
chongchongheclaude
andcommitted
fix NaN assertions that never fired due to IEEE 754 NaN comparison
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 53e1f5a commit 0cbbf54

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/problems/ParticleSink/testParticleSink.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ auto problem_main() -> int
168168
pp.query("refine_half_domain", refine_half_domain);
169169
double boost_vel_x = NAN;
170170
pp.query("boost_vel_x", boost_vel_x);
171-
AMREX_ASSERT_WITH_MESSAGE(boost_vel_x != NAN, "boost_vel_x must be set in the input file");
171+
AMREX_ASSERT_WITH_MESSAGE(std::isfinite(boost_vel_x), "boost_vel_x must be set in the input file");
172172

173173
// Problem initialization
174174
QuokkaSimulation<SinkProblem> sim;

src/radiation/radiation_system.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,10 +1018,10 @@ AMREX_GPU_DEVICE auto RadSystem<problem_t>::ComputeRadPressure(const double erad
10181018
Tnz = T[2][2];
10191019
}
10201020

1021-
AMREX_ASSERT(Fn != NAN);
1022-
AMREX_ASSERT(Tnx != NAN);
1023-
AMREX_ASSERT(Tny != NAN);
1024-
AMREX_ASSERT(Tnz != NAN);
1021+
AMREX_ASSERT(std::isfinite(Fn));
1022+
AMREX_ASSERT(std::isfinite(Tnx));
1023+
AMREX_ASSERT(std::isfinite(Tny));
1024+
AMREX_ASSERT(std::isfinite(Tnz));
10251025

10261026
RadPressureResult result{};
10271027
result.F = {Fn, Tnx * erad, Tny * erad, Tnz * erad};

0 commit comments

Comments
 (0)