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

Alp Toker alp at nuanti.com
Sat Jun 7 23:25:22 PDT 2014


On 08/06/2014 09:18, Steve (Numerics) Canon wrote:
> 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.

Hi Steve,

This is one of those (rare) cases where a unit test is appropriate. 
Could you take a look at unittests/ADT/APFloatTest.cpp?

Alp.

>
> – Steve
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-- 
http://www.nuanti.com
the browser experts




More information about the llvm-commits mailing list