sc/source/core/inc/interpre.hxx  |    3 +--
 sc/source/core/tool/interpr3.cxx |   25 +------------------------
 sc/source/core/tool/interpr4.cxx |    6 +++---
 sc/source/core/tool/parclass.cxx |    2 +-
 sc/source/ui/src/scfuncs.src     |   10 +++++++++-
 5 files changed, 15 insertions(+), 31 deletions(-)

New commits:
commit 6744d1d8f9b73375483ae04d4530f151cce40957
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Thu Jan 30 17:13:56 2014 +0100

    make Calc function PERCENTRANK comply with ODF1.2
    
    
http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2-part2.html#PERCENTRANK
    defines an optional 3rd argument. This hss now been added to the function.
    
    Change-Id: Iaa0d990261be195ad0a4b6f6be7f76b9c084da40
    Reviewed-on: https://gerrit.libreoffice.org/7747
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index e340a9e..5d361bf 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -789,8 +789,7 @@ void ScFTest();
 void ScChiTest();
 void ScRank( bool bAverage );
 void ScPercentile( bool bInclusive );
-void ScPercentrank();
-void ScPercentrank_MS( bool bInclusive );
+void ScPercentrank( bool bInclusive );
 double GetPercentrank( ::std::vector<double> & rArray, double fVal, bool 
bInclusive );
 void ScLarge();
 void ScSmall();
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index df6f990..9945140 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -3509,30 +3509,7 @@ void ScInterpreter::ScSmall()
     CalculateSmallLarge(true);
 }
 
-void ScInterpreter::ScPercentrank()
-{
-    sal_uInt8 nParamCount = GetByte();
-    if ( !MustHaveParamCount( nParamCount, 2 ) )
-        return;
-
-    double fNum = GetDouble();
-    vector<double> aSortArray;
-    GetSortArray(1, aSortArray);
-    SCSIZE nSize = aSortArray.size();
-    if (aSortArray.empty() || nSize == 0 || nGlobalError)
-        PushNoValue();
-    else
-    {
-        if (fNum < aSortArray[0] || fNum > aSortArray[nSize-1])
-            PushNoValue();
-        else if ( nSize == 1 )
-            PushDouble(1.0);            // fNum == pSortArray[0], see test 
above
-        else
-            PushDouble( GetPercentrank( aSortArray, fNum, true ) );
-    }
-}
-
-void ScInterpreter::ScPercentrank_MS( bool bInclusive )
+void ScInterpreter::ScPercentrank( bool bInclusive )
 {
     sal_uInt8 nParamCount = GetByte();
     if ( !MustHaveParamCount( nParamCount, 2, 3 ) )
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 1fa293e..205d61f 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4154,9 +4154,9 @@ StackVar ScInterpreter::Interpret()
                 case ocPercentile       :
                 case ocPercentile_Inc   : ScPercentile( true );         break;
                 case ocPercentile_Exc   : ScPercentile( false );        break;
-                case ocPercentrank      : ScPercentrank();              break;
-                case ocPercentrank_Inc  : ScPercentrank_MS( true );     break;
-                case ocPercentrank_Exc  : ScPercentrank_MS( false );    break;
+                case ocPercentrank      :
+                case ocPercentrank_Inc  : ScPercentrank( true );        break;
+                case ocPercentrank_Exc  : ScPercentrank( false );       break;
                 case ocLarge            : ScLarge();                    break;
                 case ocSmall            : ScSmall();                    break;
                 case ocFrequency        : ScFrequency();                break;
diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx
index db42e46..3da2a9d 100644
--- a/sc/source/core/tool/parclass.cxx
+++ b/sc/source/core/tool/parclass.cxx
@@ -150,7 +150,7 @@ const ScParameterClassification::RawData 
ScParameterClassification::pRawData[] =
     { ocOr,              {{ Reference                                          
  }, 1 }},
     { ocPearson,         {{ ForceArray, ForceArray                             
  }, 0 }},
     { ocPercentile,      {{ Reference, Value                                   
  }, 0 }},
-    { ocPercentrank,     {{ Reference, Value                                   
  }, 0 }},
+    { ocPercentrank,     {{ Reference, Value, Value                            
  }, 0 }},
     { ocPow,             {{ Array, Array                                       
  }, 0 }},
     { ocPower,           {{ Array, Array                                       
  }, 0 }},
     { ocProb,            {{ ForceArray, ForceArray, Value, Value               
  }, 0 }},
diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src
index 45fe3d2..2dddd09 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -5883,7 +5883,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
             0;
             ID_FUNCTION_GRP_STATISTIC;
             U2S( HID_FUNC_QUANTILSRANG );
-            2;  0;  0;
+            3;  0;  0;  1;
             0;
         };
         String 2 // Name of Parameter 1
@@ -5902,6 +5902,14 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
         {
             Text [ en-US ] = "The value for which percentage ranking is to be 
determined." ;
         };
+        String 6 // Name of Parameter 3
+        {
+            Text [ en-US ] = "significance" ;
+        };
+        String 7 // Description of Parameter 3
+        {
+            Text [ en-US ] = "The number of significant digits for the 
returned percentage: if ommitted, a value of 3 is used." ;
+        };
     };
      // -=*# Resource for function PERCENTRANK.EXC #*=-
     Resource SC_OPCODE_PERCENT_RANK_EXC
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to