[libc-commits] [libc] [libc][math] Add unit tests for raising excepts in nextafter (PR #73556)
Nishant Mittal via libc-commits
libc-commits at lists.llvm.org
Mon Nov 27 11:07:34 PST 2023
================
@@ -24,10 +24,10 @@
LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT)
#define ASSERT_FP_EQ_WITH_UNDERFLOW(result, expected) \
- ASSERT_FP_EQ_WITH_EXCEPTION(result, expected, FE_INEXACT | FE_UNDERFLOW)
+ ASSERT_FP_EQ_WITH_EXCEPTION(result, expected, (FE_INEXACT | FE_UNDERFLOW))
----------------
nishantwrp wrote:
This macro is defined something like
```cpp
#define ASSERT_FP_EXCEPT(expected) do {
// some code
LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & expected
} while(0)
```
Using `ASSERT_FP_EXCEPT(a | b)` generates something like `LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & a | b` which is not expected. Instead we want `LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & (a | b)`
https://github.com/llvm/llvm-project/pull/73556
More information about the libc-commits
mailing list