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

Ehud Katz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 10:47:28 PST 2019


ekatz marked an inline comment as done.
ekatz 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");
----------------
arsenm wrote:
> 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
Maybe just use a unique payload instead, like "123"?


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