File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -3996,14 +3996,31 @@ namespace half_float {
3996
3996
// / \throw std::range_error if `FE_INEXACT` is selected and set
3997
3997
inline void fethrowexcept (int excepts, const char *msg = " " ) {
3998
3998
excepts &= detail::errflags ();
3999
- if (excepts & (FE_INVALID|FE_DIVBYZERO))
3999
+ #if HALF_ERRHANDLING_THROWS
4000
+ #ifdef HALF_ERRHANDLING_THROW_INVALID
4001
+ if (excepts & FE_INVALID)
4000
4002
throw std::domain_error (msg);
4003
+ #endif
4004
+ #ifdef HALF_ERRHANDLING_THROW_DIVBYZERO
4005
+ if (excepts & FE_DIVBYZERO)
4006
+ throw std::domain_error (msg);
4007
+ #endif
4008
+ #ifdef HALF_ERRHANDLING_THROW_OVERFLOW
4001
4009
if (excepts & FE_OVERFLOW)
4002
4010
throw std::overflow_error (msg);
4011
+ #endif
4012
+ #ifdef HALF_ERRHANDLING_THROW_UNDERFLOW
4003
4013
if (excepts & FE_UNDERFLOW)
4004
4014
throw std::underflow_error (msg);
4015
+ #endif
4016
+ #ifdef HALF_ERRHANDLING_THROW_INEXACT
4005
4017
if (excepts & FE_INEXACT)
4006
4018
throw std::range_error (msg);
4019
+ #endif
4020
+ #else
4021
+ std::fprintf (stderr, " %s\n " , msg);
4022
+ std::terminate ();
4023
+ #endif
4007
4024
}
4008
4025
// / \}
4009
4026
}
You can’t perform that action at this time.
0 commit comments