[llvm-bugs] [Bug 34100] New: [APFloat] DoubleAPFloat::changeSign results in unusual values.

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 7 04:26:29 PDT 2017


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

            Bug ID: 34100
           Summary: [APFloat] DoubleAPFloat::changeSign results in unusual
                    values.
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: edy.burt at gmail.com
                CC: llvm-bugs at lists.llvm.org

`DoubleAPFloat::make*` always uses positive zero `Floats[1]`, even if
`Floats[0]` becomes negative (for a `Neg=true` argument).
But `DoubleAPFloat::changeSign` changes *both* `Floats[0]` and `Floats[1]`,
even when the latter is zero.
That makes negating a positive zero or infinity that is *different* than the
ones created by `makeZero(true)` and `makeInf(true)`, respectively.

My fix would be to guard the `Floats[1].changeSign();` call by
`if(Floats[1].isFiniteNonZero())`.

-- 
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/20170807/d45c88b8/attachment.html>


More information about the llvm-bugs mailing list