Set FE_OVERFLOW and FE_UNDERFLOW for expf, exp2f, exp10f, expm1f, sinhf
and coshf.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I skipped the check for math_errhandling because of the following line from https://en.cppreference.com/w/cpp/numeric/math/math_errhandling :
If the implementation supports IEEE floating-point arithmetic (IEC 60559), math_errhandling & MATH_ERREXCEPT is required to be non-zero.
libc/test/src/math/exp10f_test.cpp | ||
---|---|---|
42 | also test Underflow? |
I think that is true when the implementation is conformant. But, under __FAST_MATH__, it is expected that math_errhandling evaluates to zero: https://github.com/llvm/llvm-project/blob/main/libc/config/linux/api.td#L57. There is __NO_MATH_ERRNO__ also.
libc/src/__support/FPUtil/FEnvImpl.h | ||
---|---|---|
52 | The utils here are what I would view as "only if required" utils to be employed just before returning from a public function. So, I would prefer if they live in the src/math directory, much like https://github.com/llvm/llvm-project/blob/main/libc/src/math/generic/math_utils.h#L53. At some point they should be unified. | |
55 | if constexpr (...) here and below? |
libc/src/__support/FPUtil/FEnvImpl.h | ||
---|---|---|
55 | If I remember it right, last time I tried on some platform (maybe Apple clang on mac M1 ?), math_errhandling is defined to be a non-constexpr builtin function call __builtin_math_errhandling, making if failed to compile if math_errhandling is put under if constexpr. |
The utils here are what I would view as "only if required" utils to be employed just before returning from a public function. So, I would prefer if they live in the src/math directory, much like https://github.com/llvm/llvm-project/blob/main/libc/src/math/generic/math_utils.h#L53. At some point they should be unified.