[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
Thu Oct 6 17:52:55 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());                                              \
----------------
ddcc wrote:
> 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.
Normally I would simply `$ touch <test_files>` or `$ touch <source_files>`, and then simply run the test directly with `$ ninja libc.test.src.math.<test>`, unless the changes are in `CMakeFiles.txt`


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