[libc-commits] [PATCH] D134917: [libc] Resolve NaN/implementation-defined behavior of floating-point tests
Tue Ly via Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Oct 5 17:50:08 PDT 2022
lntue added inline comments.
================
Comment at: libc/utils/UnitTest/FPMatcher.h:75
const T neg_zero = T(FPBits::neg_zero()); \
- const T aNaN = T(FPBits::build_nan(1)); \
+ const T aNaN = T(FPBits::build_quiet_nan(1)); \
const T inf = T(FPBits::inf()); \
----------------
michaelrj wrote:
> the build failures were caused by this line. Changing it back to `build_nan` fixes the issue. Maybe add `qNaN` as an additional variable for quiet NaN purposes.
Look like the failures are actually in the implementation and tests of `atanf` and `atanhf`. According to the spec, we should not set floating point exceptional flags when the input is NaN, signaling or quiet. You can change the `atanf_test` and `atanhf_test` to `EXPECT_FP_EXCEPTION(0);` for `aNaN` inputs and simply return `x` in `atanf.cpp` and `atanhf.cpp` for NaN inputs instead of `x + 1.0f` as of now.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134917/new/
https://reviews.llvm.org/D134917
More information about the libc-commits
mailing list