<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - APFloat::toString shouldn't print extra digits"
   href="http://llvm.org/bugs/show_bug.cgi?id=17135">17135</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>APFloat::toString shouldn't print extra digits
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Support Libraries
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sharparrow1@yahoo.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=11151" name="attach_11151" title="WIP patch">attachment 11151</a> <a href="attachment.cgi?id=11151&action=edit" title="WIP patch">[details]</a></span>
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>.)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>