summaryrefslogtreecommitdiff
path: root/sc/source/core/tool/interpr3.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/tool/interpr3.cxx')
-rw-r--r--sc/source/core/tool/interpr3.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 1b0e85a20d4c..df78713f6226 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -3038,6 +3038,39 @@ void ScInterpreter::ScSkew()
PushDouble(((xcube * fCount) / (fCount - 1.0)) / (fCount - 2.0));
}
+//fdo#60322
+void ScInterpreter::ScSkewp()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSkewp" );
+ double fSum,fCount,vSum;
+ std::vector<double> values;
+ if ( !CalculateSkew( fSum, fCount, vSum, values ) )
+ return;
+
+ double fMean = fSum / fCount;
+
+ for ( size_t i = 0; i < values.size(); i++ )
+ vSum += ( values[ i ] - fMean ) * ( values[ i ] - fMean );
+
+ double fStdDevp = sqrt( vSum / fCount );
+ double dx = 0.0;
+ double xcube = 0.0;
+
+ if ( fStdDevp == 0 )
+ {
+ PushIllegalArgument();
+ return;
+ }
+
+ for ( size_t i = 0; i < values.size(); i++ )
+ {
+ dx = ( values[ i ] - fMean ) / fStdDevp;
+ xcube = xcube + ( dx * dx * dx );
+ }
+
+ PushDouble( xcube / fCount );
+}
+
double ScInterpreter::GetMedian( vector<double> & rArray )
{
size_t nSize = rArray.size();