Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for floating point exceptions #47930

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
fix build errors
  • Loading branch information
simonbyrne committed Dec 19, 2022
commit 2631abc0ac3b72f56ae0f3757d56685812beb971
6 changes: 5 additions & 1 deletion src/jlapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
#include "julia_assert.h"
#include "julia_internal.h"

#ifdef _OS_WINDOWS_
#include <float.h>
#endif

#ifdef __cplusplus
#include <cfenv>
extern "C" {
Expand Down Expand Up @@ -533,7 +537,7 @@ JL_DLLEXPORT int jl_set_fenv_except(int excepts)
fenv_t env;
fegetenv(&env);
#if defined(_CPU_AARCH64_)
env.__fpcr = env.__fpcr | (excepts << FE_EXCEPT_SHIFT);
env.__fpcr = env.__fpcr | (excepts << 8);
#elif defined(_CPU_X86_64_)
env.__control = env.__control & ~excepts;
env.__mxcsr = env.__mxcsr & ~(excepts << 7);
Expand Down