[llvm-bugs] [Bug 30781] New: APFloat does not correctly handle signaling NaN

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 25 05:31:03 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30781

            Bug ID: 30781
           Summary: APFloat does not correctly handle signaling NaN
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: dan at su-root.co.uk
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

According to IEEE-754 2008 (7.2 Invalid operation) "any general-computational
or signaling-computational operation on a signaling NaN" should generate an
invalid operation exception and return a quiet NaN.

APFloat is supposed to be IEEE-754 2008 compliant but it does not handle this
part of the spec correctly. Currently if it performs an operation on a
signaling NaN it returns `APFloat::opOK` and a signaling NaN. Instead it should
return `APFloat::opInvalidOp` and a quiet NaN.

It appears this limitation is known about because in
`unittests/ADT/APFloatTest.cpp` there is this comment

```
  // TODOS/NOTES:
  // 1. Since we perform only default exception handling all operations with
  // signaling NaNs should have a result that is a quiet NaN. Currently they
  // return sNaN.
```

I couldn't find an open bug specifically for this issue so I'm opening this
one.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161025/3d01fec3/attachment-0001.html>


More information about the llvm-bugs mailing list