[libc-commits] [PATCH] D134917: [libc] Resolve NaN/implementation-defined behavior of floating-point tests

Dominic Chen via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Oct 6 15:36:20 PDT 2022


ddcc marked 2 inline comments as done.
ddcc 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());                                              \
----------------
lntue wrote:
> 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.
Thanks for the help! Is there an easy way to rerun the test? `ninja check-llvmlibc` only works once.


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