[PATCH] D87835: [APFloat] prevent NaN morphing into Inf on conversion (PR43907)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 12:33:18 PDT 2020


spatel added a comment.

In D87835#2279926 <https://reviews.llvm.org/D87835#2279926>, @rjmccall wrote:

> So I think the only quibble here is whether it's okay for this to silently produce a qNaN when it might've started with an sNaN.  And arguably the current contract of APFloat is to perform operations as if FP exceptions were disabled, and we'll need a slightly different interface if we want to model exceptions properly.  So I think this might just be fine as-is.

If we started with a qNaN, then we can't hit the bug, right? Ie, if the MSB of the significand is set, there's no way we could shift that out. If that's correct, then we could just always set the bottom bit? That way sNaN remains sNaN even if lose the payload.

Or maybe that's not true in the case of the x87 or other special formats?


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

https://reviews.llvm.org/D87835



More information about the llvm-commits mailing list