diff options
| author | Ted Kremenek <kremenek@apple.com> | 2013-08-28 06:21:46 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2013-08-28 06:21:46 +0000 |
| commit | b33f944f4e1ad7b2b8adc36a3659d519da1b65da (patch) | |
| tree | bd06a61736382339b0d7af6101a405a2d484d99b /llvm/lib/Support/APFloat.cpp | |
| parent | 1aab6834fae4c21cccfa2366e853f44e00cbcfeb (diff) | |
| download | bcm5719-llvm-b33f944f4e1ad7b2b8adc36a3659d519da1b65da.tar.gz bcm5719-llvm-b33f944f4e1ad7b2b8adc36a3659d519da1b65da.zip | |
Revert r189442 "Change default # of digits for APFloat::toString"
This is breaking numerous Clang tests on the buildbot.
llvm-svn: 189447
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
| -rw-r--r-- | llvm/lib/Support/APFloat.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index 676e2d4ba00..34bc6b6dd6b 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -3546,14 +3546,11 @@ void APFloat::toString(SmallVectorImpl<char> &Str, // Set FormatPrecision if zero. We want to do this before we // truncate trailing zeros, as those are part of the precision. if (!FormatPrecision) { - // We use enough digits so the number can be round-tripped back to an - // APFloat. The formula comes from "How to Print Floating-Point Numbers - // Accurately" by Steele and White. - // FIXME: Using a formula based purely on the precision is conservative; - // we can print fewer digits depending on the actual value being printed. - - // FormatPrecision = 2 + floor(significandBits / lg_2(10)) - FormatPrecision = 2 + semantics->precision * 59 / 196; + // It's an interesting question whether to use the nominal + // precision or the active precision here for denormals. + + // FormatPrecision = ceil(significandBits / lg_2(10)) + FormatPrecision = (semantics->precision * 59 + 195) / 196; } // Ignore trailing binary zeros. |

