[PATCH] [APFloat] x-NaN needs to flip sign of NaN

Steve (Numerics) Canon scanon at apple.com
Sat Jun 7 23:18:46 PDT 2014


This is simple enough for review-after-commit, but I don't often work on llvm, so I thought it best to send for review.

This patch fixes http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-June/037388.html; it turned out to be caused by APFloat not negating the sign of the NaN when producing the result of (0 – NaN).  I made it flip the sign for x – NaN where x is any number.  This isn't strictly required, but is allowed by IEEE-754, and was the minimal source change to get the needed behavior for the 0 – NaN case.

I have no idea how to write a test case for this bug; APFloat seems to be, ahem, "sparsely tested" at present, so there isn't much stylistic precedent.

– Steve

-------------- next part --------------
A non-text attachment was scrubbed...
Name: APFloat-negate.patch
Type: application/octet-stream
Size: 630 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140607/ab4ef68d/attachment.obj>


More information about the llvm-commits mailing list