From d17d07620001aa7e7fd8fa9507323e9fb4a3704e Mon Sep 17 00:00:00 2001 From: martynas <> Date: Sun, 19 Jul 2015 17:41:49 +0000 Subject: [PATCH] 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. --- src/include/math.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/include/math.h b/src/include/math.h index 02e1417a..b13ad5b5 100644 --- a/src/include/math.h +++ b/src/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) \