diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-10-07 23:40:49 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-10-07 23:40:49 +0000 |
commit | 195464184e840965febb8eb55316c32995d37c8f (patch) | |
tree | ea4e0eea65ee434fe34155c18d40bdb6ea8ec567 /llvm/lib/Support/APFloat.cpp | |
parent | 133a16871f4c71d833d9dd354052846dd90d3390 (diff) | |
download | llvm-195464184e840965febb8eb55316c32995d37c8f.zip llvm-195464184e840965febb8eb55316c32995d37c8f.tar.gz llvm-195464184e840965febb8eb55316c32995d37c8f.tar.bz2 |
Fix APInt::operator*= so that it computes the correct result for large integers where there is unsigned overflow. Fix APFloat::toString so that it doesn't depend on the incorrect behavior in common cases (and computes the correct result in some rare cases). Fixes PR11086.
llvm-svn: 141441
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r-- | llvm/lib/Support/APFloat.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index b32dfeb..5307829e 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -3455,7 +3455,7 @@ void APFloat::toString(SmallVectorImpl<char> &Str, // <= semantics->precision + e * 137 / 59 // (log_2(5) ~ 2.321928 < 2.322034 ~ 137/59) - unsigned precision = semantics->precision + 137 * texp / 59; + unsigned precision = semantics->precision + (137 * texp + 136) / 59; // Multiply significand by 5^e. // N * 5^0101 == N * 5^(1*1) * 5^(0*2) * 5^(1*4) * 5^(0*8) |