ooo-build r11992 - in trunk: . patches/src680
- From: kyoshida svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r11992 - in trunk: . patches/src680
- Date: Tue, 25 Mar 2008 00:53:08 +0000 (GMT)
Author: kyoshida
Date: Tue Mar 25 00:53:08 2008
New Revision: 11992
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11992&view=rev
Log:
2008-03-24 Kohei Yoshida <kyoshida novell com>
* patches/src680/sc-formula-int-precision.diff: fix it for real. The
previous code didn't actually solve the problem but only shifted the
problem area elsewhere. This time I really reduce precision in terms
of significant digits instead of decimal places.
Modified:
trunk/ChangeLog
trunk/patches/src680/sc-formula-int-precision.diff
Modified: trunk/patches/src680/sc-formula-int-precision.diff
==============================================================================
--- trunk/patches/src680/sc-formula-int-precision.diff (original)
+++ trunk/patches/src680/sc-formula-int-precision.diff Tue Mar 25 00:53:08 2008
@@ -1,14 +1,70 @@
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/inc/interpre.hxx sc/source/core/inc/interpre.hxx
+--- sc.clean/source/core/inc/interpre.hxx 2008-03-24 20:32:36.000000000 -0400
++++ sc/source/core/inc/interpre.hxx 2008-03-24 20:38:45.000000000 -0400
+@@ -189,6 +189,13 @@ private:
+ BOOL bCalcAsShown; // Genauigkeit wie angezeigt
+ BOOL bMatrixFormula; // Formelzelle ist Matrixformel
+
++//-------------------------------------------------------------------------
++// General utility functions
++//-------------------------------------------------------------------------
++
++/** Call this to throw away digits outside the 15 significant digits. */
++double approxValue( double fValue ) const;
++
+ //---------------------------------Funktionen in interpre.cxx---------
+ // nMust <= nAct <= nMax ? ok : SetError, PushInt
+ inline BOOL MustHaveParamCount( BYTE nAct, BYTE nMust );
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/tool/interpr1.cxx sc/source/core/tool/interpr1.cxx
+--- sc.clean/source/core/tool/interpr1.cxx 2008-03-24 20:32:36.000000000 -0400
++++ sc/source/core/tool/interpr1.cxx 2008-03-24 20:41:23.000000000 -0400
+@@ -83,6 +83,35 @@ ScTokenStack* ScInterpreter::pGlobalStac
+ ScErrorStack* ScInterpreter::pGlobalErrorStack = NULL;
+ BOOL ScInterpreter::bGlobalStackInUse = FALSE;
+
++//-------------------------------------------------------------------------
++// General utility functions
++//-------------------------------------------------------------------------
++
++double ScInterpreter::approxValue( double fValue ) const
++{
++ bool bSign = ::rtl::math::isSignBitSet(fValue);
++ if (bSign)
++ fValue = -fValue;
++
++ if (::rtl::math::isNan(fValue) || ::rtl::math::isInf(fValue) ||
++ fValue == HUGE_VAL || fValue == 0.0)
++ // We don't handle these conditions. Bail out.
++ return fValue;
++
++// fprintf(stdout, "lcl_roundValue: original = %.16f\n", fValue);
++
++ int nExp = static_cast<int>( floor(log10(fValue)) );
++ nExp = 14 - nExp;
++ double fExpValue = pow(10.0, static_cast<double>(nExp));
++ fValue *= fExpValue;
++
++// fprintf(stdout, "lcl_roundValue: normalized = %.16f\n", fValue);
++ fValue = round(fValue);
++// fprintf(stdout, "lcl_roundValue: rounded = %.16f\n", fValue);
++ fValue /= fExpValue;
++// fprintf(stdout, "lcl_roundValue: restored = %.16f\n", fValue);
++ return bSign ? -fValue : fValue;
++}
+
+ //-----------------------------------------------------------------------------
+ // Funktionen
diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/tool/interpr2.cxx sc/source/core/tool/interpr2.cxx
---- sc.clean/source/core/tool/interpr2.cxx 2008-03-24 10:05:56.000000000 -0400
-+++ sc/source/core/tool/interpr2.cxx 2008-03-24 17:54:40.000000000 -0400
+--- sc.clean/source/core/tool/interpr2.cxx 2008-03-24 20:32:36.000000000 -0400
++++ sc/source/core/tool/interpr2.cxx 2008-03-24 20:42:25.000000000 -0400
@@ -419,7 +419,9 @@ void ScInterpreter::ScAbs()
void ScInterpreter::ScInt()
{
- PushDouble(::rtl::math::approxFloor(GetDouble()));
+ double fVal = GetDouble();
-+ fVal = ::rtl::math::round(fVal, 15);
-+ PushDouble(::rtl::math::approxFloor(fVal));
++ fVal = approxValue(fVal);
++ PushDouble(floor(fVal));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]