[PATCH] D69774: [APFloat] Add support for operations on Signaling NaN

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 3 14:10:00 PST 2019


arsenm added inline comments.


================
Comment at: llvm/unittests/ADT/APFloatTest.cpp:1758
   APFloat QNaN = APFloat::getNaN(APFloat::IEEEsingle(), false);
-  APFloat SNaN = APFloat::getSNaN(APFloat::IEEEsingle(), false);
+  APFloat SNaN = APFloat(APFloat::IEEEsingle(), "snan1");
   APFloat PNormalValue = APFloat(APFloat::IEEEsingle(), "0x1p+0");
----------------
ekatz wrote:
> arsenm wrote:
> > Why the 1?
> The 1 is the payload. A signaling NaN must have a payload. By default it is the highest bit after the "quiet" bit. To make the test more deterministic and not rely on implementation specifics, we define the payload explicitly. We will need the payload to make sure that when, later, a signaling NaN becomes a quiet NaN, it still has the same payload.
A few more different payload values might be good, to be sure this isn't just a single bit preserved


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69774/new/

https://reviews.llvm.org/D69774





More information about the llvm-commits mailing list