From 6de490ce0890854d0b92369d37faa569fdc0b3c1 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 25 Aug 2019 20:16:36 -0700 Subject: [PATCH] Tweak workaround for floating exceptions on macOS. --- src/microcode/floenv.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/microcode/floenv.h b/src/microcode/floenv.h index 35ec37ab0..3d0189c28 100644 --- a/src/microcode/floenv.h +++ b/src/microcode/floenv.h @@ -41,12 +41,20 @@ USA. # define scheme_fexcept_t fexcept_t # endif # ifdef __APPLE__ -# undef HAVE_FEGETEXCEPT +# ifndef HAVE_FEGETEXCEPT +# define HAVE_FEGETEXCEPT +# endif # define HAVE_FEENABLEEXCEPT # define HAVE_FEDISABLEEXCEPT // From http://www-personal.umich.edu/~williams/archive/computation/fe-handling-example.c +inline int fegetexcept(void) +{ + fenv_t fenv; + return (fegetenv (&fenv)) ? -1 : (fenv.__control & FE_ALL_EXCEPT); +} + inline int feenableexcept(unsigned int excepts) { fenv_t fenv; -- 2.25.1