ooo-build r11833 - in trunk: . patches/src680 test/calc



Author: kyoshida
Date: Thu Mar  6 18:52:45 2008
New Revision: 11833
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11833&view=rev

Log:
2008-03-06  Kohei Yoshida  <kyoshida novell com>

	* test/calc/intPrecisionTest.ods: added test file.
	
	* patches/src680/sc-formula-int-reduce-precision.diff: modified to 
	reduce precision only when the value is less than 1.0E10.  We still need
	double precision for larger values.


Added:
   trunk/test/calc/intPrecisionTest.ods   (contents, props changed)
Modified:
   trunk/ChangeLog
   trunk/patches/src680/sc-formula-int-reduce-precision.diff

Modified: trunk/patches/src680/sc-formula-int-reduce-precision.diff
==============================================================================
--- trunk/patches/src680/sc-formula-int-reduce-precision.diff	(original)
+++ trunk/patches/src680/sc-formula-int-reduce-precision.diff	Thu Mar  6 18:52:45 2008
@@ -1,14 +1,20 @@
 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-03 11:24:50.000000000 -0500
-+++ sc/source/core/tool/interpr2.cxx	2008-03-06 12:11:04.000000000 -0500
-@@ -419,7 +419,9 @@ void ScInterpreter::ScAbs()
++++ sc/source/core/tool/interpr2.cxx	2008-03-06 13:42:50.000000000 -0500
+@@ -419,7 +419,15 @@ void ScInterpreter::ScAbs()
  
  void ScInterpreter::ScInt()
  {
 -	PushDouble(::rtl::math::approxFloor(GetDouble()));
-+    // extra precision in double sometimes causes the "wrong" calculation result.
-+    float nVal = static_cast<float>(GetDouble());
-+    PushDouble(::rtl::math::approxFloor(static_cast<double>(nVal)));
++    double nVal = GetDouble();
++    if (fabs(nVal) < 1.0E10) // this is upper limit reasonable ?
++    {
++        // extra precision in double sometimes causes the "wrong" calculation result.
++        float nVal2 = static_cast<float>(nVal);
++        PushDouble(::rtl::math::approxFloor(static_cast<double>(nVal2)));
++    }
++    else
++        PushDouble(::rtl::math::approxFloor(nVal));
  }
  
  

Added: trunk/test/calc/intPrecisionTest.ods
==============================================================================
Binary file. No diff available.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]