[LLVMbugs] [Bug 17135] New: APFloat::toString shouldn't print extra digits

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 6 15:05:25 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17135

            Bug ID: 17135
           Summary: APFloat::toString shouldn't print extra digits
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11151
  --> http://llvm.org/bugs/attachment.cgi?id=11151&action=edit
WIP patch

As of r189624, calling APFloat::toString with the default arguments prints
enough digits of the value so that any float can be parsed back into the same
value which was printed (e.g. 17 digits for a double).  However, this isn't
really ideal: most floats don't need that many digits to satisfy this
round-trip property.

Having a higher-quality implementation would be convenient for clang, in cases
where we want to print out a floating-point number accurately (for diagnostics
or AST printing) without overwhelming the user with extra digits.  LLDB would
also find this useful in similar situations.

Attaching a WIP patch based on the Dragon4 algorithm from "How to Print
Floating-Point Numbers Accurately" by Steele and White, but it's a lot slower
than the current implementation, and I don't really have the expertise dealing
with floating-point numbers to know whether I'm even going in the right
direction.

(This is also tracked as <rdar://problem/14874559>.)

-- 
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/20130906/c67a4015/attachment.html>


More information about the llvm-bugs mailing list