mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Revert r189442 "Change default # of digits for APFloat::toString"
This is breaking numerous Clang tests on the buildbot. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189447 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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.
|
||||
// It's an interesting question whether to use the nominal
|
||||
// precision or the active precision here for denormals.
|
||||
|
||||
// FormatPrecision = 2 + floor(significandBits / lg_2(10))
|
||||
FormatPrecision = 2 + semantics->precision * 59 / 196;
|
||||
// FormatPrecision = ceil(significandBits / lg_2(10))
|
||||
FormatPrecision = (semantics->precision * 59 + 195) / 196;
|
||||
}
|
||||
|
||||
// Ignore trailing binary zeros.
|
||||
|
Reference in New Issue
Block a user