See https://en.cppreference.com/w/c/numeric/math/math_errhandling.html

Question: should I really define the macros conditionally on __STDC_VERSION__?

Thanks,
Luca
From 4e437b49dbdc12a6e5975ef85fe8888a18a820c6 Mon Sep 17 00:00:00 2001
From: Luca Bacci <luca.ba...@outlook.com>
Date: Mon, 7 Jul 2025 14:46:09 +0200
Subject: [PATCH] math.h: Provide definition of math_errhandling

https://en.cppreference.com/w/c/numeric/math/math_errhandling.html
---
 mingw-w64-headers/crt/math.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mingw-w64-headers/crt/math.h b/mingw-w64-headers/crt/math.h
index 65c41cd..513595d 100644
--- a/mingw-w64-headers/crt/math.h
+++ b/mingw-w64-headers/crt/math.h
@@ -168,6 +168,12 @@ extern "C" {
   #define __setusermatherr __mingw_setusermatherr
 #endif
 
+#if __STDC_VERSION__ >= 199901L
+#define MATH_ERRNO 1
+#define MATH_ERREXCEPT 2
+#define math_errhandling (MATH_ERRNO | MATH_ERREXCEPT)
+#endif
+
   double __cdecl sin(double _X);
   double __cdecl cos(double _X);
   double __cdecl tan(double _X);
-- 
2.49.0.windows.1

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to