diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2010-05-12 10:35:18 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-05-12 10:35:18 -0400 |
commit | 95d72876f31b2b0d4c398236354401ee93ac6b72 (patch) | |
tree | 994cdfeb076e8219a9616b84f625c65a55224e6f /svl | |
parent | 0c088315f95751a2911a1144fc2d0d770cdc0a55 (diff) |
koheiautodecimal: #i111533# Adjust the default display format for general number format cells.
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/numbers/zformat.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index accf306a20df..589bfd1b31dd 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1824,14 +1824,14 @@ void SvNumberformat::ImpGetOutputStdToPrecision(double& rNumber, String& rOutStr } #endif - // If truncating the value to desired precision alters the original value, - // we should show the trailing zeros, otherwise strip them. - double fRounded = ::rtl::math::round(rNumber, nPrecision); - bool bRemoveZeros = ::rtl::math::approxEqual(fRounded, rNumber); + // We decided to strip trailing zeros unconditionally, since binary + // double-precision rounding error makes it impossible to determine e.g. + // whether 844.10000000000002273737 is what the user has typed, or the + // user has typed 844.1 but IEEE 754 represents it that way internally. rOutString = ::rtl::math::doubleToUString( rNumber, rtl_math_StringFormat_F, nPrecision /*2*/, - GetFormatter().GetNumDecimalSep().GetChar(0), bRemoveZeros ); + GetFormatter().GetNumDecimalSep().GetChar(0), true ); if (rOutString.GetChar(0) == '-' && rOutString.GetTokenCount('0') == rOutString.Len()) rOutString.EraseLeadingChars('-'); // nicht -0 @@ -2079,7 +2079,7 @@ BOOL SvNumberformat::GetOutputString(double fNumber, bool bSign = ::rtl::math::isSignBitSet(fNumber); if (bSign) fNumber = -fNumber; - ImpGetOutputInputLine(fNumber, OutString); + ImpGetOutputStdToPrecision(fNumber, OutString, 10); // Use 10 decimals for general 'unlimited' format. if (fNumber < EXP_LOWER_BOUND) { xub_StrLen nLen = OutString.Len(); |