summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartynas Venckus <martynas@cvs.openbsd.org>2015-07-19 17:41:50 +0000
committerMartynas Venckus <martynas@cvs.openbsd.org>2015-07-19 17:41:50 +0000
commit29742bc144a31815cf8af6b82807bd146e1f607f (patch)
tree89a52fb17a04b837ea339a436f3294e4df69bc18
parent79ce53f5422c7e39f8f500a10144fcf8aa7d8e20 (diff)
Define new C99 macros:
- MATH_ERRNO, MATH_ERREXCEPTION and math_errhandling - Optional FP_FAST_FMA{,F,L} macros if fma() executes as fast or faster than (x * y) + z; which in practice is achievable if gcc implements __FP_FAST_FMA{,F,L} Reported by John Marino @ DragonFlyBSD.
-rw-r--r--include/math.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/math.h b/include/math.h
index 02e1417ab7e..b13ad5b5bd9 100644
--- a/include/math.h
+++ b/include/math.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: math.h,v 1.33 2014/05/03 16:13:03 martynas Exp $ */
+/* $OpenBSD: math.h,v 1.34 2015/07/19 17:41:49 martynas Exp $ */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
@@ -67,6 +67,22 @@ extern char __nan[];
#define FP_ILOGB0 (-INT_MAX)
#define FP_ILOGBNAN INT_MAX
+#ifdef __FP_FAST_FMA
+#define FP_FAST_FMA 1
+#endif /* __FP_FAST_FMA */
+
+#ifdef __FP_FAST_FMAF
+#define FP_FAST_FMAF 1
+#endif /* __FP_FAST_FMAF */
+
+#ifdef __FP_FAST_FMAL
+#define FP_FAST_FMAL 1
+#endif /* __FP_FAST_FMAL */
+
+#define MATH_ERRNO 1
+#define MATH_ERREXCEPT 2
+#define math_errhandling MATH_ERREXCEPT
+
#define fpclassify(x) \
((sizeof (x) == sizeof (float)) ? \
__fpclassifyf(x) \