From c212ef1a70b69cf83c57f1bd09829d327a769667 Mon Sep 17 00:00:00 2001 From: Jisan Halder Date: Sun, 18 Oct 2026 22:24:23 +0530 Subject: [PATCH] Allow fast-math builds by conditionally avoiding std::numeric_limits::infinity() (fixes #397) Authored and verified with ByteAsk (https://byteask.com). --- include/fast_float/parse_number.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/fast_float/parse_number.h b/include/fast_float/parse_number.h index d12a442..cb4b94a 100644 --- a/include/fast_float/parse_number.h +++ b/include/fast_float/parse_number.h @@ -61,8 +61,13 @@ from_chars_result_t } else { answer.ptr = first + 3; } +#if defined(__FAST_MATH__) || defined(FASTFLOAT_FAST_MATH) + value = minusSign ? -std::numeric_limits::max() + : std::numeric_limits::max(); +#else value = minusSign ? -std::numeric_limits::infinity() : std::numeric_limits::infinity(); +#endif return answer; } }