diff options
author | Winfried Donkers <winfrieddonkers@libreoffice.org> | 2013-11-09 20:33:13 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-11-14 19:03:53 +0000 |
commit | 53b2d2ce0c68cd371fb55c8fdbab47a4075bbe8e (patch) | |
tree | 469655ae7fac9f07e754bc25b057b4d8d3a6c359 /sc/source/core/tool/interpr3.cxx | |
parent | 663fd49286f67d1bbb7fcccc6672ba7f11401ace (diff) |
fdo#71350 add Excel 2010 function CONFIDENCE.NORM and CONFIDENCE.T
Change-Id: I341b0c7a61047627aac1f12bc4653b6f9e65b2e3
Reviewed-on: https://gerrit.libreoffice.org/6625
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/core/tool/interpr3.cxx')
-rw-r--r-- | sc/source/core/tool/interpr3.cxx | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index 3f665f30c7e4..6272792be0a5 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -2120,13 +2120,17 @@ void ScInterpreter::ScTInv() PushIllegalArgument(); return; } + PushDouble( GetTInv( fP, fDF ) ); +}; +double ScInterpreter::GetTInv( double fAlpha, double fSize ) +{ bool bConvError; - ScTDistFunction aFunc( *this, fP, fDF ); - double fVal = lcl_IterateInverse( aFunc, fDF*0.5, fDF, bConvError ); + ScTDistFunction aFunc( *this, fAlpha, fSize ); + double fVal = lcl_IterateInverse( aFunc, fSize * 0.5, fSize, bConvError ); if (bConvError) SetError(errNoConvergence); - PushDouble(fVal); + return( fVal ); } class ScFDistFunction : public ScDistFunc @@ -2247,6 +2251,20 @@ void ScInterpreter::ScConfidence() } } +void ScInterpreter::ScConfidenceT() +{ + if ( MustHaveParamCount( GetByte(), 3 ) ) + { + double n = ::rtl::math::approxFloor(GetDouble()); + double sigma = GetDouble(); + double alpha = GetDouble(); + if (sigma <= 0.0 || alpha <= 0.0 || alpha >= 1.0 || n < 1.0) + PushIllegalArgument(); + else + PushDouble( sigma * GetTInv( 1 - alpha / 2, n - 1 ) / sqrt( n ) ); + } +} + void ScInterpreter::ScZTest() { sal_uInt8 nParamCount = GetByte(); |