ooo-build r12233 - in branches/ooo-build-2-4: . patches/src680 test/excel



Author: kyoshida
Date: Sun Apr 20 22:24:58 2008
New Revision: 12233
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12233&view=rev

Log:
2008-04-20  Kohei Yoshida  <kyoshida novell com>

	* test/excel/formulaFrequency.xls: test file for FREQUENCY function.
	
	* patches/src680/sc-openformula-frequency.diff: fixed a silly regression
	that prevents the built-in FREQUENCY function from working properly by
	changing the order of the bin values randomly (i#88477).


Added:
   branches/ooo-build-2-4/test/excel/formulaFrequency.xls   (contents, props changed)
Modified:
   branches/ooo-build-2-4/ChangeLog
   branches/ooo-build-2-4/patches/src680/sc-openformula-frequency.diff

Modified: branches/ooo-build-2-4/patches/src680/sc-openformula-frequency.diff
==============================================================================
--- branches/ooo-build-2-4/patches/src680/sc-openformula-frequency.diff	(original)
+++ branches/ooo-build-2-4/patches/src680/sc-openformula-frequency.diff	Sun Apr 20 22:24:58 2008
@@ -1,13 +1,7 @@
-? sc/sc.diff
-? sc/sc.vpj
-Index: sc/source/core/inc/interpre.hxx
-===================================================================
-RCS file: /cvs/sc/sc/source/core/inc/interpre.hxx,v
-retrieving revision 1.31
-diff -u -r1.31 interpre.hxx
---- sc/source/core/inc/interpre.hxx	27 Sep 2007 13:53:32 -0000	1.31
-+++ sc/source/core/inc/interpre.hxx	18 Dec 2007 02:43:35 -0000
-@@ -650,7 +650,8 @@
+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-04-20 15:27:24.000000000 -0400
++++ sc/source/core/inc/interpre.hxx	2008-04-20 15:27:56.000000000 -0400
+@@ -657,7 +657,8 @@ void ScStandard();
  void ScSkew();
  void ScMedian();
  void GetSortArray(BYTE nParamCount, double** ppSortArray, SCSIZE& nSize);
@@ -17,13 +11,9 @@
  void ScModalValue();
  void ScAveDev();
  void ScDevSq();
-Index: sc/source/core/tool/interpr3.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/core/tool/interpr3.cxx,v
-retrieving revision 1.20
-diff -u -r1.20 interpr3.cxx
---- sc/source/core/tool/interpr3.cxx	31 Jul 2007 16:36:46 -0000	1.20
-+++ sc/source/core/tool/interpr3.cxx	18 Dec 2007 02:43:35 -0000
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/tool/interpr3.cxx sc/source/core/tool/interpr3.cxx
+--- sc.clean/source/core/tool/interpr3.cxx	2008-04-20 15:27:24.000000000 -0400
++++ sc/source/core/tool/interpr3.cxx	2008-04-20 16:58:36.000000000 -0400
 @@ -56,6 +56,8 @@
  #include "scmatrix.hxx"
  #include "globstr.hrc"
@@ -33,7 +23,7 @@
  // STATIC DATA -----------------------------------------------------------
  
  #define SCdEpsilon                1.0E-7
-@@ -3063,216 +3065,184 @@
+@@ -3063,216 +3065,184 @@ void ScInterpreter::ScTrimMean()
  
  void ScInterpreter::GetSortArray(BYTE nParamCount, double** ppSortArray, SCSIZE& nSize)
  {
@@ -298,16 +288,7 @@
 +    }
 +
 +    if (nGlobalError == 0)
-+    {
-+        SCSIZE nInd;
-+        SCSIZE nValCount = static_cast<SCSIZE>(rSortArray.size());
-+        for (SCSIZE i = 0; (i + 4) <= nValCount-1; i += 4)
-+        {
-+            nInd = rand() % (int) (nValCount-1);
-+            ::std::swap(rSortArray[i], rSortArray[nInd]);
-+        }
 +        QuickSort(rSortArray, pIndexOrder);
-+    }
  }
  
 -void ScInterpreter::QuickSort(long nLo, long nHi, double* pSortArray)
@@ -406,30 +387,35 @@
 +
 +void ScInterpreter::QuickSort(vector<double>& rSortArray, vector<long>* pIndexOrder)
 +{
-+    long n = static_cast<long>(rSortArray.size());
++    size_t n = rSortArray.size();
 +
 +    if (pIndexOrder)
 +    {
 +        pIndexOrder->clear();
 +        pIndexOrder->reserve(n);
-+        for (long i = 0; i < n; ++i)
-+            pIndexOrder->push_back(i);
++        for (size_t i = 0; i < n; ++i)
++            pIndexOrder->push_back(static_cast<long>(i));
 +    }
 +
 +    if (n < 2)
 +        return;
 +
++    size_t nValCount = rSortArray.size();
++    for (size_t i = 0; (i + 4) <= nValCount-1; i += 4)
++    {
++        size_t nInd = rand() % (int) (nValCount-1);
++        ::std::swap( rSortArray[i], rSortArray[nInd]);
++        if (pIndexOrder)
++            ::std::swap( pIndexOrder->at(i), pIndexOrder->at(nInd));
++    }
++
 +    lcl_QuickSort(0, n-1, rSortArray, pIndexOrder);
  }
  
  void ScInterpreter::ScRank()
-Index: sc/source/core/tool/interpr5.cxx
-===================================================================
-RCS file: /cvs/sc/sc/source/core/tool/interpr5.cxx,v
-retrieving revision 1.28
-diff -u -r1.28 interpr5.cxx
---- sc/source/core/tool/interpr5.cxx	1 Nov 2007 14:22:08 -0000	1.28
-+++ sc/source/core/tool/interpr5.cxx	18 Dec 2007 02:43:36 -0000
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/tool/interpr5.cxx sc/source/core/tool/interpr5.cxx
+--- sc.clean/source/core/tool/interpr5.cxx	2008-04-20 15:27:24.000000000 -0400
++++ sc/source/core/tool/interpr5.cxx	2008-04-20 16:07:06.000000000 -0400
 @@ -63,6 +63,10 @@
  #include "globstr.hrc"
  #include "cellkeytranslator.hxx"
@@ -441,7 +427,7 @@
  const double fInvEpsilon = 1.0E-7;
  
  // -----------------------------------------------------------------------
-@@ -2232,51 +2236,52 @@
+@@ -2272,51 +2276,52 @@ void ScInterpreter::ScFrequency()
  	if ( !MustHaveParamCount( GetByte(), 2 ) )
  		return;
  

Added: branches/ooo-build-2-4/test/excel/formulaFrequency.xls
==============================================================================
Binary file. No diff available.



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