Enforce floating arithmetic prerequisites for polynomial certificates

This commit is contained in:
2026-09-17 09:35:59 -04:00
parent 4418b25d45
commit fc944c1bfe
2 changed files with 13 additions and 0 deletions

View File

@@ -15,6 +15,12 @@ module;
#include <mfem.hpp>
#include <mpi.h>
// Outward enclosure depends on ordinary floating-point operations. Optimizers
// that discard NaNs or reassociate expressions invalidate the certificate.
#if defined(__FAST_MATH__) || (defined(__FINITE_MATH_ONLY__) && __FINITE_MATH_ONLY__ > 0)
#error "Polynomial enthalpy certification does not support fast-math or finite-math-only compilation."
#endif
export module mean_field:solver.enthalpy_admissibility;
export import :field.mfem;
@@ -54,6 +60,11 @@ export namespace mean_field::solver {
}
namespace mean_field::solver::enthalpy_detail {
static_assert(std::numeric_limits<double>::is_iec559 && std::numeric_limits<double>::radix == 2 &&
std::numeric_limits<double>::digits == 53 && std::numeric_limits<double>::max_exponent == 1024 &&
std::numeric_limits<double>::has_denorm == std::denorm_present,
"Polynomial enthalpy certification requires IEEE 754 binary64 with subnormal support.");
// Bounds concern the represented polynomial, not a tolerance-relaxed EOS.
// Exact zero is retained algebraically so a prescribed zero trace does not
// become an unresolved negative interval merely through outward rounding.