From c347b1500f2de832bf35ee01d733d2360e1af691 Mon Sep 17 00:00:00 2001 From: "Michael F. Herbst" Date: Fri, 23 Oct 2026 21:55:42 +0200 Subject: [PATCH] Avoid ieee_is_nan --- src/dftd3/model.f90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dftd3/model.f90 b/src/dftd3/model.f90 index 0a2a02a0..8b08ad76 100644 --- a/src/dftd3/model.f90 +++ b/src/dftd3/model.f90 @@ -15,7 +15,6 @@ ! along with s-dftd3. If not, see . module dftd3_model - use, intrinsic :: ieee_arithmetic, only : ieee_is_nan use dftd3_citation, only : citation_type, get_citation, doi_fourier_d3 use dftd3_data, only : get_r4r2_val, get_vdw_rad use dftd3_fourier_decomposition, only : d3_lowrank_c6, d3_lowrank_config, new_lowrank_c6 @@ -328,7 +327,9 @@ end subroutine weight_references elemental function is_exceptional(val) real(wp), intent(in) :: val logical :: is_exceptional - is_exceptional = ieee_is_nan(val) .or. abs(val) > huge(val) + ! NaN is the only value that compares unequal to itself + ! (equivalent, but more compatible than using ieee_is_nan) + is_exceptional = val /= val .or. abs(val) > huge(val) end function is_exceptional