summaryrefslogtreecommitdiff
path: root/math/math.h
diff options
context:
space:
mode:
Diffstat (limited to 'math/math.h')
-rw-r--r--math/math.h42
1 files changed, 41 insertions, 1 deletions
diff --git a/math/math.h b/math/math.h
index c7895b735f..0c19d450ee 100644
--- a/math/math.h
+++ b/math/math.h
@@ -560,8 +560,48 @@ extern int matherr (struct exception *__exc);
/* Define special entry points to use when the compiler got told to
only expect finite results. */
#if defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0
+
+/* Include bits/math-finite.h for double. */
+# define _Mdouble_ double
+# define __MATH_DECLARING_DOUBLE 1
+# define __MATH_DECLARING_LDOUBLE 0
+# define _MSUF_
# include <bits/math-finite.h>
-#endif
+# undef _Mdouble_
+# undef __MATH_DECLARING_DOUBLE
+# undef __MATH_DECLARING_LDOUBLE
+# undef _MSUF_
+
+/* When __USE_ISOC99 is defined, include math-finite for float and
+ long double, as well. */
+# ifdef __USE_ISOC99
+
+/* Include bits/math-finite.h for float. */
+# define _Mdouble_ float
+# define __MATH_DECLARING_DOUBLE 0
+# define __MATH_DECLARING_LDOUBLE 0
+# define _MSUF_ f
+# include <bits/math-finite.h>
+# undef _Mdouble_
+# undef __MATH_DECLARING_DOUBLE
+# undef __MATH_DECLARING_LDOUBLE
+# undef _MSUF_
+
+/* Include bits/math-finite.h for long double. */
+# if __MATH_DECLARE_LDOUBLE
+# define _Mdouble_ long double
+# define __MATH_DECLARING_DOUBLE 0
+# define __MATH_DECLARING_LDOUBLE 1
+# define _MSUF_ l
+# include <bits/math-finite.h>
+# undef _Mdouble_
+# undef __MATH_DECLARING_DOUBLE
+# undef __MATH_DECLARING_LDOUBLE
+# undef _MSUF_
+# endif
+
+# endif /* __USE_ISOC99. */
+#endif /* __FINITE_MATH_ONLY__ > 0. */
#ifdef __USE_ISOC99
/* If we've still got undefined comparison macros, provide defaults. */