From 29742bc144a31815cf8af6b82807bd146e1f607f Mon Sep 17 00:00:00 2001 From: Martynas Venckus Date: Sun, 19 Jul 2015 17:41:50 +0000 Subject: 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. --- include/math.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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) \ -- cgit v1.2.3