[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
Fri Sep 30 14:46:31 PDT 2022


lntue added inline comments.


================
Comment at: libc/src/__support/FPUtil/FPBits.h:182
     FPBits<T> bits = inf();
-    bits.set_mantissa(v);
+    bits.set_mantissa(QUIET_BIT | v);
     return T(bits);
----------------
michaelrj wrote:
> this would make it impossible to generate a signaling NaN with this function, since it would always set the quiet bit. Currently the expectation is that the client code will pass a mantissa with the quiet bit set iff the resulting NaN should be quiet.
It's probably better to add another method called `build_quiet_nan` and leave `build_nan` to create signaling nan if needed?  Most of `build_nan` usage in `src/math` folder then can simply be replaced with `build_quiet_nan`.


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