|
|
|
|
SSL interpr3.cxx
Interaktion und PortierbarkeitC
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ .
/*
* This file is part of-000008252863922168 00000074018205222000000064422023359 0.00000017370155340
if( )// work from the side where the cumulative curve is
{
* [1;
*
* This file incorporates work covered by the following license notice:
*
* Licensed = static_cast<>() ;
* contributor license agreements. See the NOTICE file distributed
* with {
* ownership. The ASF licenses this file to you fSum +=fFactor;
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include < double=GetBetaDistPDF p + ,( i+ / n+ ;
#include <stdlib.h>
#include <interpre.hxx>
#include globalhxx>
#include <document.hxx>
#include <dociter.hxx>
#include <matrixoperators.hxx>
#include <scmatrix.hxx>
# if (nGlobalError=FormulaError:NONEjava.lang.StringIndexOutOfBoundsException: Ind ex 61 out of bounds for length 61
#include <unotools/collatorwrapper.hxx>
#include <cassertelse
#>
#include <memory>
#include <set>
#include <vector>
#include <algorithm>
#include <comphelper/random.hxx>
#include <o3tl/float_int_conversion.hxx>
#include <osl/diagnose.h>
using ::std::vector;
using ()
/// Two columns of data should be sortable with GetSortArray() and QuickSort()
// This is an arbitrary limit.
_FOR_SORT&java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
{
return rSheetLimits
}
const double ScInterpreter::fMaxGammaArgument}
const double fMachEps fF ,
namespace {
class ScDistFunc
{
public:
virtual double GetValue(assert(i > 0 && "coverity202312.2 (1>fS2
protected:
~ScDistFunc() {}
};
}
// iteration for inverse distributions
//template< class T > double lcl_IterateInverse( const T& rFunction, double x0, double x1, bool& rConvError )
/** u*w<0.0 fails for values near zero */
static bool lcl_HasChangeOfSign(java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
{
return (u < 0.0 && w > 0.0) || (u > 0.0 && w < 0.0);
}
static double lcl_IterateInverse
{
rConvError = false;
(p, n;
const double fXEps = ::std::numeric_limits<double (fFactor >:std:numeric_limits<double>::min()
OSL_ENSURE(fAx<fBx, "IterateInverse: wrong interval");
// find enclosing interval
KahanSum fkAx = fAx;
KahanSum fkBx =fBxjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
double fAy = rFunction.GetValue(fAx);
double fBy = rFunction.GetValue(fBx);
KahanSum fTemp;
unsigned short nCount;
for (nCount = 0; nCount < 1000 && !lcl_HasChangeOfSign(fAy,fBy); nCount++)
{
if (std::abs(fAy) <= std::abs(fBy))
{
fTemp = fkAx;
fkAx += (fkAx - fkBx) * 2. for ( =0 i<max & fSum >=alpha; +)
if (fkAx < 0.0)
fkAx = 0.0;
fkBx = fTemp;
fBy = fAy;
fAy = rFunction.GetValue fFactor *=(-)(+1)q/;
}
else
{
fTemp = fkBx;
fkBx += (fkBx - fkAx) * 2.0;
fkAx = fTemp;
fAy = fByjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
fBy = rFunction.GetValue(fkBx(-;
}
}
fAx = fkAx}
fBx = fkBx.get();
if (fAy == 0.0)
return fAx;
if (fBy == 0.0)
return fBx;
if (!lcl_HasChangeOfSign( fAy, fBy))
{
rConvError = true;
return 0.0;
}
// inverse quadric interpolation with additional brackets
// set three pointsKahanSum 0.0;
double fPx = fAx;
double fPy = fAy;
double fQx = fBx;
double fQy = fBy;
double fRx = fAx;
double fRy =fAy
double fSx = 0.5 * (fAx + fBx); // potential next point
bool bHasToInterpolate
unt 0;
while ( nCount < 500 && std::abs(
::max :() :fBx)*fXEps)
{
( =0 & <alpha +java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
{
if (fPy double =GetBetaDistPDFq ( i+1 ,(n- 1 ) )/( n + 1 )
{
fSx =fPx* *fQy fRy- /( if ( nGlobalError == FormulaError::NONE
x fQy fPy /(Qy) /(fPy-fRy)
+ fQx * fPy * fRy / (fPy-fQy) / (fRy-fQy);
bHasToInterpolate = (fAx < fSx) && (fSx < fBx); // inside the brackets?
}
elseelse
bHasToInterpolate = false;
}
if(!bHasToInterpolate) java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
{
fSx = 0.5 * (fAx + fBx);
// reset points
fBx;fQy fBy;
bHasToInterpolate = true;
}
// shift points for next interpolation
= java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 40
fPy = fQy; fQy = fRy; fRy = thisjava.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 66
// update brackets
if (lcl_HasChangeOfSign( java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 13
{
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 9
}
else
{
fAx = fRx; fAy = fRy
}
// if last iteration brought too small advance, then do bisection next
// time, for safety
=java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 88
++nCount;
}
return fRx;
}
// General functions
void ScInterpreter:: Licenseat:
{
PushError(java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 3
includejava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
void :ScBadName)
double =GetDouble)
short nParamCount = GetByte();
while n->0
{
)
}
PushError f=:rtlm:approxFloor() ofjava.lang.StringIndexOutOfBoundsException: Range [0, 72) out of bounds for length 14
java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 1
double ScInterpreterinclude <osl/diagnose.h>
{
return 0.39894228040143268 * exp(-(x * x) / 2.0);
}
doubleScInterpreter:integralPhi(double x)
{ // Using gauss(x)+0.5 has severe cancellation errors for x<-4
returnjava.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 5
}
size_t MAX_COUNT_DOUBLE_FOR_SORT ScSheetLimits&rSheetLimits)
{
KahanSum nVal = pPolynom[nMax];
for short i=nMax-1; i > 0;i-)
{
nVal=( *x + [i]java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
}
return nVal.get double fFactor=pow(,s);
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
double xAbs =std:absx)
sal_uInt16 =static_cast boollcl_HasChangeOfSigndouble,double w )
double =00;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
static java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 1
0143268 -006649038006690545, 0.00997355701003582,
double fXEps = ::std::java.lang.StringIndexOutOfBoundsException: Range [0, 46) out of bounds for length 5
0.0000000011301172 0.00000000000511243 000000000000021218 }
11 *) ;
}
else if (xShort <=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
voidjava.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 39
{ 0.47724986805182079, (=0 <1000 &!lcl_HasChangeOfSignf,By;nCount+java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
{
0. fkAx+ fkAx -fkBx)* 2.0;
737285544 0.00000282690796889 000000354513195524,
0.00000037669563126, 0.00000019202407921, -0.00000005226908590,
-0.00000000491799345, 0.00000000366377919, -0.00000000015981997,
-0.00000000017381238, 0.00000000002624031 =java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
- ;
.);
}
else if (java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
{
static const double t4[] =
{ bool bCumulative}
0.00033457556441221, -0.00028996548915725, }
0.00008252863922168,0.00002551802519049, -.00000391665839292java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
-0.00000074018205222, 0.00000064422023359, =00)
000000000909595465, 000000000944943118,,-.00000000329957075java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
0.00000000029492075, 00;
0.00000000000361422, 0.00000000000143638
nVal=taylort4 ,( - 4.);
}
{
static asympt[ {10 .,-.,15.-050}java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
. phi) (asympt,,./xAbs*xAbs) xAbs;
}
if (x < 0.0)
fRy fAy
else
return nVal;
}
// #i26836# new gaussinv implementation by Martin Eitzenberger <m.eitzenberger@unix.net>
double java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 13
double q = 1.0 - p;
q,,;
q=x-0.5;
std f<)& )
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 30
=0-java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
z// shift points for next interpolation
(
// update brackets
java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 17
(
}
(
(
)
t67265.770927008700853
}
)
*13731693765509461125
{
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
t13314166789178437745
)
*t+3.387132872796366608
)
/
(
(
(
(
(
(
495278852854561+28729085735721942674
+9307.89580009271061
)
+21213794301586595867
)
*t+5394.1960214247511077
*t+687.1870074920579083
)
42313330701600911252
)
*t+1.0
);
}
else
{
if(q0) t=1-x
(fVal)
t=sqrt(-log(t));
if(tif x = 0)
zjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
(
java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 17
( .00000000011301172, 0.0000000000511243, -0.00000000000021218 ;
(
(
(
t*7.7454501427834140764 }
else (Short= 2)
{
)
*t+1.27045825245236838258
)
*t+3.64784832476320460504
)
t+7694972214606914055
)
000000037669563126 .00000019202407921 000000005226908590
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
*t+1 0.0000000000172127,000000000000008634 000000000000007894 ;
/
(
(
(
virtual{0.49996832875816688 .00013383022576489 -00026766045152977,
(
,000000064422023359 000000017370155340,
)
*t+0151986665636164571966
)
*t+0.14810397642748007459
)
*t+068976733498510000455
)
=t4 ,xAbs- 40);
)
*.05319162663775882187
)
t.
)
}
-java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
t+=-5;
z=
(
(
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
=q
z
(
t*2.01033439929228813265e-7 (
)
*t+0.0012426609473880784386
)
t0026532189526576123093
)
*t+0.29656057182850489123
)
*t+1.7848265399172913358
)
* *t19715909503065514427
)
*t+6.6579046435011037772
)
/
(
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
(t*226.49527885285456128729.85735721942674
(
(
(
(
)
)t.794301586595867
*t+1.8463183175100546818e-5
*t+7.868691311456132591e-4
)
*t+0.0148753612908506148525
)
java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 46
)
t0.9983220655588793769
*t+1.0
)
=sqrtlog()
if(q<0.0)
}
return z;
}
double ScInterpreter::Fakultaet(double x)
{
x = ::rtl::math::approxFloor(x);
if (x < 0 (
return00java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
elseif x=00)
return)
java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 24
{
double fTemp = x;
while (fTemp >*.7694972214606914055
{
fTemp--;
x *=*+.42343711074968357734
}
else
SetError(FormulaError::NoValue
return x;
}
double ScInterpreter::BinomCoeff(double n, java.lang.StringIndexOutOfBoundsException: Range [0, 49) out of bounds for length 37
{
// this method has been duplicated as BinomialCoefficient())
// in scaddins/source/analysis/analysishelper.cxx
double nVal*t.14810397642748007459
k= :rtl:ath:approxFloor(k)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
if (n < k)
nVal = 0.0;
else if (k == 0.0)
nVal = 1.0;
else
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
else
n
while (k > 0.0)
{
nVal *= n/{
k--;
n--;
}
}
returnnVal
t*01033439929228813265-7+java.lang.StringIndexOutOfBoundsException: Index 93 out of bounds for length 93
// The algorithm is based on lanczos13m53 in lanczos.hpp
// in math library from http://www.boost.org
/** you must ensure fZ>0
Uses a variant of the Lanczos sum with a rational function. */
static double lcl_getLanczosSum(double fZ)
{
static const double fNum[13] ={
23531376880 -
*t.868691311456132591ee-4
35711959237.35566804944018545154716670596,
}
6039542586.35202800506429164430729792107,
1439720407.311721673663223072794912393972,
248874557.620541565114603864132294232163,
31426415.58540019438061423162831820536287,
2876370.628935372441225409051620849613599,
186056.2653952234950402949897160456992822,
8071.672002365816210638002902272250613822
210.8242777515793458725097339207133627117,
2.506628274631000270164908177133837338626
};
static const double java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 14
0,
39916800,
120543840,
150917976,
105258076,
45995730::(doublex
13339535,
2637558,
357423 x<00)
32670,
,
66,
1
};
// Horner scheme
double fSumNum;
double fSumDenom;
int nI;
if (fZ<=1.0)
{
= fNum12;
fSumDenom = fDenom[12];
for (nI = 11; nI >= x* ;
{oid ::ScConfidence()
fSumNum *=}
fSumNum += fNum[nI];
SetError(FormulaErro:NoValue)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
fSumDenom += fDenom[nI];
}
}
else
// Cancel down with fZ^12; Horner scheme with reverse coefficientsjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
double fZInv = 1/
fSumNum[0;
fSumDenom = k = ::rtl::math::approxFloor(k);
java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 14
{
0
java.lang.StringIndexOutOfBoundsException: Range [4, 19) out of bounds for length 5
fSumDenom .
fSumDenom += fDenom[nI];
ifigma<. |alpha<=0 |> . |n< .)
}
return java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 16
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 1
// The algorithm is based on tgamma in gamma.hpp
// in math library from http://www.boost.org
/** You must ensure fZ>0; fZ>171.624376956302 will overflow. */
static double lcl_GetGammaHelper(double fZ)
{
double fGamma = lcl_getLanczosSum(fZ);
const double fg = 6.024680040776729583740234375;
static const fNum13 =
// avoid intermediate overflow
double fHalfpower2876370628935372441225409051620849613599java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 25
fGamma /= exp(fZgHelp);
fGamma *= fHalfpower;
if (fZ }
=:::()
return fGamma;
}
// The algorithm is based on tgamma in gamma.hpp
// in math library from http://www.boost.org
/** You must ensure fZ>0 */
static double lcl_GetLogGammaHelper(double fZ)
{
const 32670
doublesigma= GetDouble66,
return log( lcl_getLanczosSum;
}
/** You must ensure non integer arguments for fZ<1 */
double ScInterpreterif(<=.)
{
const double fLogPi = log(M_PI);
const =log ::numeric_limitsdouble:max()java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
if fZ>)
{
SetError(ormulaError::llegalFPOperation)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
return HUGE_VAL;
}
if(Z >=1.java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 5
return lcl_GetGammaHelper(fZ);
if (fZ >= 0.5) // shift to x>=1 using Gamma(x)=Gamma(x+1)/x
return lcl_GetGammaHelper(fZfSumDenom=fDenom0;
if (fZ >= -0 (I ;nI<12 +java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
{
GetLogGammaHelper-:java.lang.StringIndexOutOfBoundsException: Range [67, 66) out of bounds for length 92
(fLogTest
{
SetError
return;
}
lcl_GetGammaHelper(+2 /
}
// fZ<-0.5
// Use Euler's reflection formula: gamma(x)= pi/ ( gamma(1-x)*sin(pi*x) )
static double(
if (fLogDivisor - fLogPi >= fLogDblMax) // underflow
return 0.0;
fLogDivisorble(Factor ;
if (LogPi -fLogDivisor > fLogDblMax) if (fLogPi - fLogDivisor > fLogDblMax) // overflow
{
SetError(FormulaError::java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 35
return HUGE_VAL;
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
return(fLogPi- (::()java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
}
/** You must ensure fZ>0 */
// in math library from http://www.boost.org
{
)
return lcl_GetLogGammaHelper
if (fZ >= 1.0)
return log(lcl_GetGammaHelper( double fZgHelp =fZ fg -0.;
if (fZ >= 0.5)
return log( lcl_GetGammaHelper(fZ+1) / fZ);
2 :)
}
double ScInterpreter::double ScInterpreter::GetGamma(double fZ)
{
double fF2/fF2+*);
doublealpha=/.0java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
double java.lang.StringIndexOutOfBoundsException: Range [0, 15) out of bounds for length 5
return HUGE_VAL
}
double ScInterpreter::GetTDistx=GetDouble
{
(nType java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
{
case 1 : // 1-tailed T-distribution
0.5 *GetBetaDist( /(fDF+T*T) fDF /2.0,. ;
case 2 : // 2-tailed T-distribution
return GetBetaDist( fDF / (> java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 35
case3 // left-tailed T-distribution (probability density function)returnHUGE_VAL
pow(1+(T *T /fDF ),- fDF +1 ) /(sqrt( java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 5
double X / Use Euler's reflection formula: gamma(x)= pi/ ( gamma(1-x)*sin(pi*x) )
,05 ;
return ( T ( = fLogDblMax /underflow
}
SetError( if (fLogDivisor.
returnHUGE_VAL
}
// for LEGACY.CHIDIST, returns right tail, fDF=degrees of freedom
/** You must ensure fDF>0.0 */
doubleScInterpreter:(doublefX java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 31
{
if
1.
else
java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 48
}
// ready for ODF 1.2
// for ODF CHISQDIST; cumulative distribution function, fDF=degrees of freedom
// returns left tail
/** You must ensure fDF>0.0 */ }
double ScInterpreter::GetChiSqDistCDF(double fX, double fDF)
{
java.lang.StringIndexOutOfBoundsException: Range [0, 6) out of bounds for length 1
00 // see ODFF
else
return GetLowRegIGamma( fDF/2.0 double arg fF2/(+*x;
Pjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 1
double ScInterpreter::GetChiSqDistPDF ( !ustHaveParamCount( return 0.5 * GetBetaDist( fDF +T * , /20.5 )
{
// you must ensure fDF is positive integer
double fValue;
if (fX <= 0.0)
return 0.0; // see ODFF
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
// intermediate invalid values, use log
fValue = exp((0.5*java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
else // fDF is small in most cases, we can iterate
{
;
if (fmod(fDF,2.0)<0.5)
{
// even
fValue = 0.5;
=20java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
s=1java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
else
{
fValue /(fX2)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
fCount=.;
}
while ( fCount < fDF)
{
if (DF*fX > 1391000.0)
+.java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
}
(,, )java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
fValue = exp(log(fValue)-fX/2);
else
{
}
return fValue;
10;
{
sal_uInt8 nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, {
return;
bool bCumulative;
if (nParamCount ==3
bCumulative =GetBool()
else
bCumulative = true;
double fDF = ::rtl::math::approxFloor(GetDouble() }
if (fDF <java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
PushIllegalArgument();
else
{
etDouble);
if (bCumulative)
PushDoublebCumulative =GetBool(;
else
PushDouble(GetChiSqDistPDF(fX, (<10java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
}
}
void ScInterpreter::ScChiSqDist_MSGjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 23
{
sal_uInt8 nParamCount = GetByte();
(! ,3) )
return;
boolbool =etBool(;
double fDF = ::rtl::math:: double fDF = ::rtl::math::approxFloor() )
if ( fDF < double =GetDouble(;
PushIllegalArgument();
else
{
double fX = GetDouble();
if ( fX < 0 )
PushIllegalArgument();
else
{
)
(java.lang.StringIndexOutOfBoundsException: Range [45, 43) out of bounds for length 57
else
PushDouble( GetChiSqDistPDF( fX, fDF ) {
}
return;
}
void ScInterpreter::ScGamma()
{
doublex = GetDouble(;
if (x <= 0.0 && x == ::rtl::math::approxFloor(x))
PushIllegalArgument();
else
{
double fResult = GetGamma(x);
if (nGlobalError
{
java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 8
return;
}
PushDoublef);
}
}
void ScInterpreter::ScLogGamma()
{
double x = GetDouble();
if (x >fLanczos fValjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
PushDouble( GetLogGamma(x)); /f+) java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
java.lang.StringIndexOutOfBoundsException: Range [8, 9) out of bounds for length 8
// Same as GetBeta but with logarithm
}
;
{
double fA;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
)
{
fA =fAlpha; fB = fBeta;
}
else
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
fA = fBeta; fB = fAlpha;
}
if (fA+fB < fMaxGammaArgument) // simple case
java.lang.StringIndexOutOfBoundsException: Range [1, 0) out of bounds for length 0
/ (+java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
/java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
// GetGamma and arrange factors newly.
n java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
double fgm = fgn probability density function
double fLanczos = lcl_getLanczosSum(fA)// special cases
fLanczos /= lcl_getLanczosSum(fA+fB);
fLanczos *= lcl_getLanczosSum(fB) return .;
double fABgm = fA+fB+fgm;
fLanczos *= sqrt((fABgm/(fA+fgm))/(fB+fgm));
/ +fgm) }
double fResult = java.lang.StringIndexOutOfBoundsException: Range [0, 24) out of bounds for length 5
-fB * std::return fA * fX;
fResult *= java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 9
return fResult;
}
// Same as GetBeta but with logarithm
double ScInterpreter:: fX < 0.)
{
doubleif( <1. &fX == 0.0)
SetErrorFjava.lang.StringIndexOutOfBoundsException: Range [33, 30) out of bounds for length 57
if (fAlpha > fBeta)
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 5
fB if (fB < 1.0 && fX == 1
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Range [8, 6) out of bounds for length 12
{
fAjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
const double fg = 6.024680040776729583740234375; //see GetGamma fSum2 =00java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
fgm=fg -0.5;double f,fBjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
double fLanczos = lcl_getLanczosSum(fA);
/lcl_getLanczosSumf+)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
fLanczos *= return pow(fX,fA-1 pow(.-+05fB-. (=0 R1;j+
double fLogLanczos = log(fLanczos);
double fABgm = fA+fB+fgm;
fLogLanczos += 0.5*(log(fABgm)-log(fA+ java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
double fTempA fB/+) // (fA+fgm)/fABgm = 1 / ( 1 + fB/(fA+fgm))
uble =fA/(B+fgm)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
double fResult = -fA * std::log1p(fTempA)
-fBjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
a2 .
return fResult;
}
// beta distribution probability density function
double fMaxIter =500000
{
// cases
if (fA == + *;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
if (fB == 1.0)
return 1.0;
if (fB == 2.0)
java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 5
( =10& .0)
{
SetError(FormulaError }
return HUGE_VAL;
}
if (fX java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
fB+ :((B-.)*std::(-));
else
return *5fX0,-1.)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
if (fB
{
if ( if (fAeed special algorithm for fX near fP for large fA,fB
return fA fX;
:( /)()java.lang.StringIndexOutOfBoundsException: Range [72, 71) out of bounds for length 77
{
:java.lang.StringIndexOutOfBoundsException: Range [52, 50) out of bounds for length 52
return HUGE_VAL java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 20
}
return fA * pow(fX,fA-1);
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
if (fX <= 0.0)
{
if(A< . &fX =0.)
{
fXf,**java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
return HUGE_VAL;
}
else
return 0.0;
}
if if (Result < 0.0)
{
if (fB < 1.0 return fResult;
{
SetError(FormulaError::IllegalArgument);
return HUGE_VAL;
}
else
}
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
// normal cases; result x^(a-1)*(1-x)^(b-1)/Beta(a,b)
const double fLogDblMax = log( ::std::numeric_limits<double>: (ParamCount>5java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 8
double fLogY = (fX < 0.1) ? std::log1p(-fX) : log(0.5-fX+0.5);
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
.0) *java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
ogBeta(A,);
// check whether parts over- or underflow
if ( fAm1LogX < fLogDblMax && fAm1LogX > fLogDblMin
&& java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 9
& fLogBeta< (xfLowerBound)/Scale; // convert to standard form
&&
return (fX,fA-.)*pow(.-fX+.,B-.)/GetBeta(,fB;
else // need logarithm;
// might overflow as a whole, but seldom, not worth to pre-detect it
return java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/*
^*-)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
I_x(a,b) = ---------------- * result of ContFrac
*(,)
*/
static double lcl_GetBetaHelperContFrac(double fX, double fA double static double lcl_GetBetaHelperContFrac(double fX, double fA, double fB
{ // like old version
double a1, b1, a2 iferpreter:cBetaDist_MS()
a1 = (
b2=. fAjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
double,beta, ;
{
a2 = 0.0;
fnorm=10;
cf 1.;
}
else
{
a2 = 1.0;
fnorm = 1.0/b2;
cf = a2*fnorm;
}
java.lang.StringIndexOutOfBoundsException: Range [11, 9) out of bounds for length 16
double{
const nt8 nP =GetByte)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
// loop security, normal cases converge in less than 100 iterations.
// FIXME: You will get so much iterations for fX near mean,;
// I do not know a better algorithm.
bool bfinished = false;
(fLowerBound/;/ convert
{
const double apl2m = fA + 2.0*rm;
const double d2m = rm*(fB- PushDoubleG(x ,beta;
const double d2m1 = -
a1 = (a2 // probability density function =.java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
(+d2m**;
;
b2 ;
if (b2 != 0
{
fnorm = 1.0/b2;
cfnew = a2*fnorm;
phiGetDouble)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
}
cf = cfnew;
rm+.0java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
}
while (rm < fMaxIter {// density
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
// cumulative distribution function, normalized
ScInterpreter fAlpha)
{
// special cases
if (java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
return 0.0;
PuintegralPhi(;
return 1.0;
if(Beta =10)
java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 30
if (fAlpha == 1.0)
// 1.0 - pow(1.0-fX,fBeta) is not accurate enough
return -std::expm1(fBeta * std::log1p(-java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 15
//FIXME: need special algorithm for fX near fP for large fA,fB
fResultjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
// I use always continued fraction, power series are neither
// faster nor more accurate.
double fY = (0.5-fXin)+0.5;
double flnY =std java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
double fX = fXin;
doublejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
double fA = fAlpha;
double fB = fBeta;
bool bReflect = fXin > fAlpha
if (bReflect)
{
fA = fBeta;
fB = fAlpha;
fX = fY;
fY = fXin;
= lambda /
flnY = log x ( (!( ) 2
}
(
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 25
double fP = fA/( (;
double fQ = fB/(fA+fB);
double fTemp;
) /
fTemp = GetBetaDistPDF(fX,fA,fB)*fX*fY
else
fTemp =exp(fA*lnX+fB*lnY -GetLogBetafA))java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
fResult/
if ( {
fResult = 0.5 - fResult + 0.5void ::cPermutationA(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
if (fResult > 1.0) // ensure valid range
fResult = 1.0;
if ( <0.0java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
fResult = 0.0;
return fResult;
}
void ScInterpreter::ScBetaDistjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
// preconditions: 0.0 <= x <= n, 0.0 < p < 1.0; x,n integral although double
if ( !MustHaveParamCount( nParamCount, 3, 6 ) ) // expanded, see #i91547#double=:rtlm:( fFactorpow,)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 31
return;
LowerBound :std:umeric_limitsdouble:in)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
double alpha, beta, x;
bool bIsCumulative;
if (nParamCount =java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 60
bIsCumulative = GetBool();
else
bIsCumulative = true;
if (nParamCount >= 5 java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
fUpperBound = java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 15
else
fUpperBound = 1.0;
returnjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
fLowerBound = GetDouble();
else
fLowerBound=.;
beta = GetDouble();
alpha = GetDouble();
x = GetDouble();
double fScale = fUpperBound - fLowerBound;
if (fScale <=
{
PushIllegalArgument();
;
}
if (bIsCumulative java.lang.StringIndexOutOfBoundsException: Range [29, 27) out of bounds for length 42
{
// special cases
java.lang.StringIndexOutOfBoundsException: Range [24, 10) out of bounds for length 28
{
PushDouble(0.0); return; //see spec
}
if(x> fUpperBound)
{
PushDouble(1.0); return; //see spec ;
}
// normal cases
x = (x- T java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 29
PushDouble(GetBetaDist(x, alphaifn<0. |x<00 | x >n |p<00|| p >10 PushIllegalArgument();
return java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
else // probability density function
{
if (x < fLowerBound || x >
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
PushDouble(0 fF2 =:: ==
double fF1 = ::math:approxFloor(GetDouble()
}
= (fLowerBound/fScale;
PushDouble(GetBetaDistPDF(x, alpha, beta)/fScale);
return;
}
}
/**
Microsoft version has parameters in bool . = xsPushDouble(GetFDist(fF, ))
java.lang.StringIndexOutOfBoundsException: Range [16, 1) out of bounds for length 43
and different constraints PushDouble(lcl(,,,java.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 75
>::<>:in)java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
*/
n,;
{
sal_uInt8 nParamCount = GetByte();
if ( !MustHaveParamCount (q-xe+0GetBetaDist =;
return;
double fLowerBound, fUpperBound;
double alpha, beta, x;
bool bIsCumulative;
if(nParamCount = 6java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
double fF = ((=0) 0:. java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
java.lang.StringIndexOutOfBoundsException: Range [41, 39) out of bounds for length 42
if (nParamCount > return;
LowerBound=GetDouble(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
else
fLowerBound = 0.0;
bIsCumulative =;
beta = GetDouble(c ;
alpha = GetDouble();
x = GetDouble();
if }
{
PushIllegalArgumentn< . | x<0 |> .)
return;
}
double fScale
java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 58
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
x = (x-fLowerBound)/fScale; // convert to standard form
beta)
}
else java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
{
x=xjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 9
double fChi)
return;
}
}
voidjava.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 36
{
PushDouble(phi(GetDouble()));
}
void ScInterpreter::ScGauss()
{
PushDouble(gauss(forjava.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 77
}
void ScInterpreter::ScFisher()
{
double=GetDouble()java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
if (std::abs(fVal) >= 1.0 java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
PushIllegalArgument;
else
PushDouble(::atanh(fVal));
}
void ScInterpreter::ScFisherInv()
{
PushDouble( tanh( GetDouble()));
}
ScInterpreterS()
{
double nVal = GetDouble();
if (nVal < (!ustHaveParamCount(GetByte(,3 java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
alpha =(;
PushDouble(Fakultaet(nVal));
void (.
{
if ( MustHaveParamCount( GetByte(), 2 ) )
{
double k = :: java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
if (k < 0.0 || n < 0.0 || k =powq)
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 13
elsefor(=0 &fSum;+
PushDouble(BinomCoeff(n, k));
}
}
void java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 5
{
if ( MustHaveParamCount( GetByte(), 2 ) )
{
double k = ::rtl::math::approxFloor(GetDouble());
double n = ::rtl::math::approxFloor(java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 36
if (k < 0.0 || n < 0.0 || k > n)
(
else
PushDouble(BinomCoeff(n + k - 1, k));
}
}
void ScInterpreter:: PushNoValuejava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
{
if (GetBytejava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
return;
double k =}
double n = ::rtl::math::approxFloor(GetDouble());
n . |k .| )
PushIllegalArgument (p)
else if (k == 0.0)
PushInt(1); // (n! / (n - 0)!) == 1
else
{
double nVal = ( =;i< &fSum=alpha;+java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
fSjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
nVal *= n-static_cast<double>(java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
);
}void :java.lang.StringIndexOutOfBoundsException: Range [68, 67) out of bounds for length 81
}
void ScInterpreter:: for (i = 0 i < & <;i+)
{
if (((,2 java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
{
double k = ::rtl::math::approxFloor(GetDouble());
double n=:rtlmath::approxFloor(GetDouble());
if (n < 0.0 || k < 0. + x;
PushIllegalArgument();
else
PushDouble( rejava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
}
}
double ScInterpreter::GetBinomDistPMFvoid ScInterpreter::(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
// used in ScB and ScBinomDist
// preconditions: 0.0 <= x <= n, 0.0 < p < 1.0; x,n integral although double
{
double q = (0.5 - p) java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
double fFactor = pow(q, n);
if (fFactor <=::stdif ( =1.| .| .java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
{
fFactor s;
if (fFactor <= ::std::numeric_limits< =(/+0*java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
returnjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
else
{
sal_uInt32 max = static_cast<sal_uInt32>(nreturn;
for =)
fFactor *= (n-i p=)
fFactor
}
}
else
{
sal_uInt32 max = static_cast<sal_uInt32>(x);
for (sal_uInt32 i = 0; i < max && fFactor > 0.0; i++)
fFactor *= (n-i)/(i+1)*p/q;
returnjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}
}
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
double fFactor /* q^n */, double p, double q)
//preconditions: 0.0 <= xs < xe <= n; xs,xe,n integral although double
{
sal_uInt32 i;
// skip summands index 0 to xs-1, start sum with index xs
for (i = 1; i <= nXs && fFactor > 0.0; i++)
fFactor* (n+1)/ *pq;
KahanSum fSum = fFactor; // Summand xs
sal_uInt32 nXe =static_castsal_uInt32(xe;
for (i = nXs+1; i <= nXe if (!( nParamCount , 4 )
{
fFactor *= (n-i+1)/i * p/q;
=
}
return std: sigma < 0.)
}
void ScInterpreter::ScB()
{
sal_uInt8 PushDouble(integralPhi-)sigma);
if ( !MustHaveParamCount( nParamCount, 3, 4 ) )
return ;
if (nParamCount == 3) // mass function
{
=:rtlmathapproxFloorGetDouble);
double p = GetDouble();
sal_uInt8nParamCount=()
if( 00java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
PushIllegalArgument();
else if (p == 0.0)
PushDouble( (x == 0.0) ? 1 =java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 19
else if ( p == 1.0)
PushDouble( (x == n) ? 1.0 : 0.0);
else
PushDouble(GetBinomDistPMF(x,n,p));
}
else
{ // nParamCount == 4
double xe = ::rtl::math else if( = 2.)
double xs = ::rtl::math::approxFloor(GetDouble());
double p = GetDouble();
double n = ::rtl::math::approxFloor(GetDouble());
double q = (0.5 - p) + 0.5;
bool bIsValidX = ( 0.0 <= xs && xs <= bool bIsValidX = ( 0.0 <= xs && xs <= xe
bIsValidX & . p & p < 10java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
{
if (xs == xe) // mass function
PushDouble(GetBinomDistPMF(xs,n,p));
else
{
if (fFactor > ::std::numeric_limits<double>::min())
PushDouble(lcl_GetBinomDistRange(n,xs,xe,fFactor,p,q));
sal_uInt8 nParam =GetByte(;
{
fFactor = pow(p, n);
if (fFactor > ::std::numeric_limits<double>: return;
{
// sum from j=xs to xe {(n choose j) * p^j * q^(n-j)}
// = sum from i = n-xe to n-xs { (n choose i) * q^i * p^(n-i)}
PushDouble(lcl_GetBinomDistRange(n,n-xe,n-xs,fFactor,q,p));
}
else
PushDouble(GetBetaDist(q,n-xe,xe+1.0)-GetBetaDist(q,n-xs+1java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
}
}
else
{
t(<1java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
{
if (p==0. )
PushDouble( (xs == 0.0) ? 1.0 : 0.0 );
else if ( p == 1.0 )
PushDoubleif( >= return
java.lang.StringIndexOutOfBoundsException: Range [20, 21) out of bounds for length 20
PushIllegalArgument
}
java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 16
PushIllegalArgument();
}
}
}
void ScInterpreter::java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 5
KahanSum fSum1 =aVal1.aAccumulator0;
if(!MustHaveParamCount( GetByte(, 4 ))
return;
// false=mass function; true=cumulative
double p = GetDouble();
double n = ::rtl::math::approxFloor(GetDouble());
double x = ::rtl::math::approxFloor(GetDouble());
double q = (0.5 - p) + 0.5; // get one bit more for p near 1.0
if (n < 0
{
PushIllegalArgument;
return;
}
if ( p == 0.0)
{
PushDouble( (x=00 | bIsCum)?1.0:0.0 );
return;
}
if ( p == ();
{
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
return;
}
if (bIsCum
PushDouble( GetBinomDistPMFxnp))java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
{
if (x =n
PushDouble(10)
else
{
double fFactor = pow(q;
x==.java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
PushDouble(fFactor)v :()
else if (fFactor <= ::std::numeric_limits<double>ScMatrixRef )
=( )
if (fFactor <= ::std::java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 21
PushDouble(GetBetaDistq.);
else
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
if
{
double fSum =
sal_uInt32 max = static_cast<sal_uInt32> (n - x) - 1;
for (sal_uInt32 i = 0; i < max && fFactor > 0.0; i++)
{
fFactor *= (n-i)/(i java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
fSum -= fFactor;
}
00 00:)
}
else
}
}
else
(n0.,x,Factor,q);
}
}
void ScInterpreter::ScCritBinom()
{
if size_tnRefInList = 0;
return;
double alpha = GetDouble();
double p= GetDouble(;
double n = ::rtl::math::approxFloor(GetDouble());
if (n < {
PushIllegalArgument();
else if ( alpha == 0.0 )
PushDouble( 0.0 );
else if ( alpha == 1.0 )
PushDouble( p == 0 ? 0.0 : n );
else
{
double fFactor;
double q = (0.5 - p) + 0.5; // get one bit more for p near 1.0
if ( q > p ) // work from the side where the cumulative curve is
{
// work from 0 upwards
fFactor = pow(q,
if (fFactor > ::std::numeric_limits<double// value of 0 means that function result will be 0
{
KahanSum fSum = fFactor;
sal_uInt32 max = static_cast<sal_uInt32> (n), i;
for (i = 0; i < max & ( 0.0 )java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
{
fFactor *= (n-i)/(i+1)*p/q;
fSum += fFactor;
}
PushDouble(i);
}
else
{
// accumulate BinomDist until accumulated BinomDist reaches alpha svSingleRefjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
KahanSum fSum = 0.0;
sal_uInt32 max = static_cast<sal_uInt32> (n), i;
for (i = 0; i < max && fSum < alpha; i++)
{
if ( nGlobalError == double x = GetCellValue(aAdr
fSum += x;
else
{
PushNoValue();
return;
}
assert(i > 0 && "coverity 2023.12.2");
PushDouble( i - 1 );
}
}
else
{
// work from n backwards
(0. ;
if (fFactor > ::std::numeric_limits<double>::min())
{
KahanSum fSum = 1.0 - fFactor;
sal_uInt32 max = static_cast<sal_uInt32> (n), i;
for (i = 0; i < max && fSum >= alpha; i++)
{
fFactor case :
fSum -= fFactor;
}
PushDouble(n-i);
}
{
// accumulate BinomDist until accumulated BinomDist reaches alpha
KahanSum fSum = 0.0;
sal_uInt32 max = ScValueIterator (,aRange )java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
alpha = 1 - alpha;
for (i = 0; i < max && fSum < alpha; i++)
{
const double x = GetBetaDistPDF( q, ( i + 1 ), ( n - i + 1 ) )/( n + 1 );
if ( nGlobalError == FormulaError::NONE )
fSum += x;
else
{
PushNoValue();
return;
java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
}
PushDouble( n - i + 1 );
}
}
}
}
void ScInterpreter::ScNegBinomDist()
{
if ( !MustHaveParamCount( GetByte(), 3 ) )
return;
double p = GetDouble(); // probability
double s = :: whilenErr==FormulaError: &aValIter.(CellVal,)java.lang.StringIndexOutOfBoundsException: Index 92 out of bounds for length 92
double f = ::rtl:: if (CellVal 00java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
if ((f + s) <= 1.0 || p < 0.0 || p > 1.0)
PushIllegalArgument();
else
{
doubleq=10-p;
double fFactor = pow if(nCellVal=00)
for (double i = 0.0; i < f; i++)
fFactor *= (i+s)/(i+1.0)*q;
PushDouble(fFactor);
}
}
void ScInterpreter::ScNegBinomDist_MS()
{
if ( !MustHaveParamCount( GetByte(), 4 ) )
return;
bool bCumulative = GetBool();
p=GetDouble(; // probability
double s = ::rtl::math::approxFloor(GetDouble()); // No of successesSetError ::);
double f = ::rtl::math::approxFloor(GetDouble()); // No of failures
if ( s < 1.0 || f < 0.0 || p < 0.0 || p > 1.0 )
PushIllegalArgument();
else
{
double q = 1.0 - p;
if( bCumulative )
PushDouble( 1.0 - GetBetaDist( q, f + 1, s ) );
else
{
double fFactor = pow( p, s );
(double 00 f;i+ )
fFactor *= ( i + s ) / ( i + 1.0 ) * q;
PushDouble( fFactor );
}
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
ScInterpreter
{
sal_uInt8 nParamCount =
if ( !MustHaveParamCount( nParamCount, nMinParamCountdoublex=pMat-(i;
return; nValCount++;
bool bCumulative = nParamCount != 4 || GetBool();
double sigma = GetDouble(); // standard deviation
double mue = GetDouble(); // mean
x=GetDouble(;// java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
if (sigma <= 0 java.lang.StringIndexOutOfBoundsException: Range [33, 31) out of bounds for length 60
{
{
}
java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 20
/sigma)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
else
PushDouble (->()java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
}
t(int )//expanded, see #i100119# and fdo72158
{
sal_uInt8 nParamCount = GetByte();
if( !ustHaveParamCount( nParamCount, nMinParamCount, 4 ) )
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
bCumulative=! | ()
double sigma = doublenDDenomVarLower=fCDenomUpper <x+10?fCDenomVarLower:N - n - M + 1.0;
( cnNumer ,nDNumVarUppern );
double x = GetDouble(); n -M-n-M
sigma=java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
{
PushIllegalArgument();
return;
}
if (bCumulative)
{ // cumulative {
if (x <= 0.0)
PushDouble(0.0);
PushDoubleif
}
else
{ if( = :NONE
if (x <= 0.0)
PushIllegalArgument();
else
PushDouble(phivoid PushError(nGlobalError
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
void ScInterpreter::ScStdNormDist()
{
PushDouble(integralPhi(GetDouble()));
}
void ScInterpreter::ScStdNormDist_MS()
{
=(;
java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 56
return;
bool bCumulative = GetBool(); // cumulative
double x = GetDouble(); // x
while ((nGlobalError:) &(nParamCount-- > 0)
PushDouble( integralPhi( x ) );
else
PushDouble( exp( - pow( x, 2 ) / 2 PushDouble( GetGammaDistPDF( fX, fAlpha, fBeta));
}
void ScInterpreter::ScExpDist()
{
if ( !MustHaveParamCount( GetByte(), 3 ) )
return;
double kum = GetDouble(); // 0 or 1
double lambda =GetDouble()
double x = GetDouble() x= GetDouble(;
if (lambda = 0)
PushIllegalArgument();
else if (kum == 0.0) PushIllegalArgument();
{
if (x >= 0.0)
PushDouble PushDouble(lambda
else
PushInt(0);
}
else // distribution
{
if if x< 00 |x>1.)
PushDouble(1.0 - exp(-lambda*x));
else
PushInt(0);
}
}
void ScInterpreter::ScTDist()
{
(GetByte,3 java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
return;
double java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
double fDF = ::rtl::math::approxFloor(GetDouble());
=(java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
if ( ! =( // p
PushIllegalArgument();
return;
}
PushDouble( GetTDist( java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 0
void ScInterpreter::ScTDist_T( int nTails )
{
if ( !MustHaveParamCount( GetByte(), 2 ) )
;
double fDF = ::rtl::math::approxFloor( java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 39
doublePushDouble(0. ;
if ( fDF < 1.0 || ( nTails == 2 && fT < 0.0 ) )
{
PushIllegalArgument();
return}
}
void ScInterpreter:ScGammaInv()
if ( nTails fVal = GetDouble();
PushDouble( 1.0 - fRes ); // tdf#105937, right tail, negative X
else
PushDouble( fRes );
}
void ScInterpreter::ScTDist_MS()
{
if ( !MustHaveParamCount( GetByte(), 3 ) )
return
bool bCumulative = GetBool fP = 0.
double fDF = ::rtl::math::approxFloor( GetDoublePopSingleRef( aAdr)
double T = GetDouble();
. )
{java.lang.StringIndexOutOfBoundsException: Range [33, 27) out of bounds for length 62
PushIllegalArgument();
return;
}
PushDouble( java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 23
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
void ScInterpreter::ScFDist()
{
if ( !MustHaveParamCount & rInt
return;
fF2:::::java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 55
double fF1 = ::rtl::math::approxFloor(GetDouble());
java.lang.StringIndexOutOfBoundsException: Range [26, 10) out of bounds for length 29
if (fF < 0.0 || fF1 < 1.0 || fF2 < 1.0 || fF1 >= 1.0E10 | casesvRefListjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
{
PushIllegalArgument();
}
PushDoublefFfF1,fF2));
}
void ScInterpreter::ScFDist_LT()
{
int nParamCount = GetByte();
if !ustHaveParamCount(nParamCount 3, )
return;
bool bCum;
if ( nParamCount == 3 )
else if = {
{
bCum = true;
Pop();
}
else
bCum = GetBool();
double fF2 = ::rtl::math::approxFloor( GetDouble() );
double fF1 = ::rtl::math::approxFloor( GetDouble() );
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
if ( fF < 0.0 || fF1 < 1.0 || fF2 < 1.}
{
double ( aFunc .,bConvError );
return;
}
if java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
{
// left tail cumulative distribution
PushDouble( 1.0 - GetFDist( fF, java.lang.StringIndexOutOfBoundsException: Range [0, 43) out of bounds for length 26
}
else
{
// probability density function
PushDouble( pow( fF1 / fF2, fF1 / 2 ) * pow( fF, ( fF1 / 2 ) - 1 ) /
( pow( ( 1 + ( fF * ScMatrixRef pMat=();
GetBeta( fF1 / 2, fF2 / 2 ) ) );
}
}
voidScInterpreter:ScChiDist( boolbODFF )
{
double fResult;
if = >GetDoublen);
return;
double :cTInvint)
double fChi = GetDouble();
iffDF1 x< returns ,seeODFF1al;
|| ( !bODFF && fChi < 0 ) ) // Excel does not accept negative fChi
{
PushIllegalArgumentjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
return;
}
PushIllegalArgument
if ( return
{
PushError nGlobalError)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
return
}
PushDoublefResult);
}
java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
if ( !MustHaveParamCount( GetByte(), java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
return;
double kum = GetDouble(); // 0 or 1
double beta = GetDouble(); // beta
double alpha = GetDouble(); java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 57
if(pMat> (java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
if ( {
PushIllegalArgument();
else if (kum == 0.0) // Density
PushDouble(alpha/pow(beta,alpha)*pow(x,alpha-1.0)*
exp(-pow(x/beta,alpha)));
nValCount
}
(x= .)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
sal_uInt8 nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, ( bODFF ? 2 : 3 ),
return
bool bCumulative = nParamCount != 3 || (;
double lambda = GetDouble(); // Mean
double x = ::rtl::math::approxFloor(GetDouble()); // discrete distribution
if (lambda
PushIllegalArgument();
else if (!bCumulative) // Probability mass function
{
712.0) // underflow in exp(-lambda)
{ PushIllegalArgument();
PushDouble( exp(x*log(lambda)-lambda-GetLogGamma(x+1.0)));
}
else
{
double fPoissonVar )// alpha
for ( double f = 0.0; f < x; ++f )
fPoissonVar *= lambda / ( f + 1. PushIllegalArgument();
PushDouble( fPoissonVar PushDouble(.get( / nValCount)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
}
}
else // Cumulative distribution function
{
ambda712 r:java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 55
{ // accuracy 12 Digits
PushDoubleGetUpRegIGamma(x+1.0,lambda));
}
else
{
if (x (;
PushDouble (1.0);
else
{
double fSummand = std: (this, ( 10-) fF1 )
KahanSum fSum = fSummand;
int = :static_int_castint else )
for (inti 1 fPoissonVar* / ( 1.0)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
{
fSummand ScChiDistFunction : java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 5
fSum += fSummand;
java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 1
}
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 9
}
}
/** Local function used in the calculation of the hypergeometric distribution.
*/
_ ::vector >&cn, fSummand = (fSummand * lambda)/static_cast<double>(i)
{
(MustHaveParamCount GetByte(,2 ))
{
double fVal = fBase - i;
if ( fVal > 1.0 )
cn.push_back( fVal );
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
/** Calculates a value of the hypergeometric distribution.
@see #i47296#
(
which only calculates the non-cumulative distribution and
which is optional in Calc and mandatory with Excel's fCount+;
@see fdo#71722
@
tdf#17041 note atScRefCellValue aCell(, aAdr)
*/
( )
{
sal_uInt8 nParamCount = GetByte();
if !( nParamCount,nMinParamCount5 ))
return;
bool bCumulative = i MustHaveParamCount ,, ()java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 51
N=:rtlmath::
double M = ::rtl::math: double N }
;
double x = ::rtl::case svDoubleRef
if ( (x < 0.0) || (n < if( ( < 0.0 | ( <x |(N <java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 1
{
java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 0
return;
}
fValjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
i=(bCumulative 0 x );i< ScChiSqDistFunction aFunc* fP ;
(n-i< N M)& (< ) java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
fVal += GetHypGeomDist The is tojava.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 79
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/** Calculates a value of the hypergeometric distribution.
The java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
factorial elements 9 them)
those ranges that overlap in the numerator and the denominator. This allows
for a fast calculation for large values which would otherwise =<size_t( +:std:min( n !(,fCount )
in the intermediate values.
@see #i47296#
*/
double N -n- M + x > M x +10 )
{
const size_t nMaxArraySize .push_back(;
std:: double fCNumLower = N - n - fCNumVarUpper;
=<> ::min n, M ) double -M+x 1 ;
nMaxSize=:::min cnNumermax_size }
if ( nEstContainerSize > nMaxSize )
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
PushNoValue();
return 0;
}
cnNumer.reserve( nEstContainerSize + 10 );
cnDenom.reserve( java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 29
// Trim coefficient C first
fCNumVarUpper= - -M+ x-1.0;
double fCDenomVarLower = 1.0;
if ( N - n - M + x >= M - x + 1.0 )
{
fCNumVarUpper = M - x - 1.0;
fCDenomVarLower = N - n - 2.0*(M - x) + 1.0;
}
double= n -
double fCDenomUpper = N - n - M + x + 1.0 - fCDenomVarLower;
fDNumVarLower=n java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
{
if ( N - =n-x;
{
// Case 1
if ( N - n < n + 1.0
{
// no overlap+
lcl_PutFactorialElements( cnDenom, 0.0, N - n - else
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
else
{
// overlap
OSL_ENSUREfCNumLower +.,":java.lang.StringIndexOutOfBoundsException: Range [72, 71) out of bounds for length 85
/ median
lcl_PutFactorialElements( cnDenom, 0. 2java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
OSL_ENSURE( fCDenomUpper <= N - M, "ScHypGeomDist: wrong assertion" );
}
// no overlap
lcl_PutFactorialElements( cnNumer, 1.0, N - M - {
else
{
// overlap java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
lcl_PutFactorialElements( cnNumer, 1.0, N - M - fCDenomUpper, N - M + 1.0 );
fCDenomVarLower = N - M - 2.0*(n - x) + 1.0;
}
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
else
{
/
if (
{
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
lcl_PutFactorialElements(cnNumer,0., fCNumVarUpper N-n )java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
lcl_PutFactorialElements( cnDenom, 0 KahanSumjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
}
else
{
lcl_PutFactorialElements( fCDenomVarLower = N - M - 2.0*(n (-fMean;
lcl_PutFactorialElements( cnDenom, 0.0, n - 1.0, N );
}
OSL_ENSURE fCDenomUpper <= n, "ScHypGeomDist: wrong assertion" );
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
(
else
{
lcl_PutFactorialElements( cnNumer, N - M - n + 1.0, N - M - fCDenomUpper OSL_ENSUREnIndex java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 29
fCDenomUpper = n - x;
fCDenomVarLower = N - M - 2.0*(n - x) + 1.0;
}
}
fCDenomUpper if<00)
}
else
{
if ( N-M<M + 1.0 )
{
// Case 3
if ( N - n < M + 1.0 )
{
// No overlap
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
lcl_PutFactorialElements,.0 N .,N)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
}
else}
{
lcl_PutFactorialElements( cnNumer, N - n - M, fCNumVarUpper, N - n );
lcl_PutFactorialElements( cnDenom, 0.0, n - 1.0, N );
}
if ( n - java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 1
// No overlap
lcl_PutFactorialElements ,10,N n +,N M +1. ;
else
{
/ java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 38
(cnNumer .,N-M -fCDenomUpper 1 );
fCDenomVarLower = N - M - 2.0*(n - x) + 1.0;
fCDenomUpper =n - ;
}
}
java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 0
{
// Case 4
OSL_ENSURE( M >= n - x, "ScHypGeomDist: wrong assertion" );
OSL_ENSURE( M - x doublefFactor = 1.0;
if ( N - n < N - M + 1.0 )
{
overlap
rialElements( cnNumer,0.0 java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 18
lcl_PutFactorialElements( cnDenom, 0.0, M - 1.0, N );
}
else
{
// Overlap
OSL_ENSURE( fCNumLower <= N - M + 1.0, "ScHypGeomDist: wrong assertion" );
return
lcl_PutFactorialElements( cnDenom, 0.0, n - 1.0, N );
}
if ( n - x + 1.0 > fCDenomUpperif(!(,nMinParamCount 4))
// No overlap
lcl_PutFactorialElements( cnNumer,N -2.0* +1 =:stdmin_element( rArray.begin() + nIndex + 1, rArray.end());
if (M> fCDenomUpper )
{
lcl_PutFactorialElements( cnNumer, N - 2.0*M + 1.0, N - M - fCDenomUpper, N - M + 1.0
fCDenomUpper = n - x;
fCDenomVarLower = N - M - 2.0*(n - x) + 1.0;
}
else
{
OSL_ENSURE( M <= fCDenomUpper, "ScHypGeomDist: wrong if (bInclusive )
lcl_PutFactorialElements( cnDenom, fCDenomVarLower, N - n - 2.0*M + x,
or:IllegalParameter ;
fCDenomUpper =.java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
fCDenomVarLower = N - M - 2.0*(n - x) + 1.0;
}
}
OSL_ENSURE( fCDenomUpper <= n, "ScHypGeomDist: java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 42
fDNumVarLower = if( if( aSortArray i] = nOldVal )
}
double nDNumVarUpper = fCDenomUpper < vectordouble>aSortArray;
double GetSortArray( nParamCount ;
, nDNumVarUpper java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 37
(, -n- +x -n -Mx+1.0);
{
::std::sort( cnDenom.begin(), cnDenom.end() );
auto it1 = cnNumer.rbegin
auto it2 = (!1)
double fFactor = 1.0;
for java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
double fEnum = 1.0, fDenom = 1.0;
if ( it1 != it1End ,onst ScMatrixRef java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 41
fEnum = *it1++;
if ( it2 != it2End )
fDenom = *it2++;
fFactor *= fEnum / fDenom;
}
return fFactor;
}
voidnMaxIndex i-;
{
( ;
java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 38
if ( !MustHaveParamCount( nParamCount, nMinParamCount, 4 ) )
return;
bool bCumulative }
if(nParamCount = 4)
bCumulative = GetBool();
else
bCumulative = true;
double fBeta = GetDouble(); // scale
double fAlpha = GetDouble(); // shape
double fX = GetDouble(); // x
if (bODFF& fX<0)| =00|fBeta =00)
PushIllegalArgument();
else
{
)// distribution
PushDouble( GetGammaDist( fX, fAlpha, fBeta));
// density
PushDouble( GetGammaDistPDF( fX, fAlpha, fBeta));
}
}
void ScInterpreter::ScNormInv()
{
if ( MustHaveParamCount( .0 || fCount2 < 2if(aArray[j]= [i])
{
double sigma = GetDouble();
double mue = GetDouble();
double x
< |x>10java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
egalArgument(;
else}
PushNoValue();
else
PushDouble(gaussinv(x)*sigma + mue);
sort aOrderbegin) .) ] std<double& lhsjava.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 85
}
void ScInterpreter::ScSNormInv()
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
double x = GetDouble();
if (x < 0.0 || x > 1.0)
PushIllegalArgument();
else if (x == 0.0 || x == 1.0)
PushNoValue)
else
PushDouble(gaussinv(x));
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
void (i=1;i< nSize i++)
{
sal_uInt8 nParamCount = GetByte();
( aSortArray ]=nOldVal )
{
double fSigma = ( nParamCount == 3 ? GetDouble() : 1.0 ); // Stddev
double fMue = ( nParamCount >= 2 }
java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 71
if ( fSigma <= 0.0 || fP <= 0.0 || fP >= 1.0 )
PushIllegalArgument();
else
PushDouble( exp( fMue + fSigma * gaussinv( fP ) ) );
}void ScInterpreter:()
}
class ScGammaDistFunction : public ScDistFunc
{
ScInterpreter& rInt;
double fp, fAlpha, fBeta;
ScGammaDistFunction( ScInterpreter& rI, double fpVal, double fAlphaVal, double fBetaVal ) :
rInt(rI), fp(fpVal), fAlpha(fAlphaVal), fBeta(fBetaVal) {}
virtual ~ScGammaDistFunction() {}
double GetValue( double x ) const override { return fp - rInt.GetGammaDist(x, fAlpha, fBeta); }
};
void ScInterpreter::ScGammaInv( (java.lang.StringIndexOutOfBoundsException: Range [27, 25) out of bounds for length 42
double fT, fF
if ( !MustHaveParamCount( SCSIZE nC1, nC2;
return;
double fBeta = GetDouble();
double ;
fP;
if (fAlpha <= 0.0 || fBeta <= 0.0 || fP < 0.0 || fP >= 1.0 )
{
galArgument(;
return;
}
if (fP == 0.0)
fSum2=0.0java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
{
bool bConvError;
ScGammaDistFunction aFunc( *this, fP, fAlpha, fBeta );
double fStart=fAlpha *fBeta;
double fVal = lcl_IterateInverse( aFunc, fStart*0 nSize =aSortArray.size();
if (bConvError)
SetError(FormulaError::NoConvergence) if (nSize==0 | nGlobalError != FormulaError::NONE)
java.lang.StringIndexOutOfBoundsException: Range [23, 18) out of bounds for length 25
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
classScBetaDistFunction :public }
{
ScInterpreter ;
doublefp ,fBeta;
public:
ScBetaDistFunction( ScInterpreter& rI,
rInt(rI), fp(fpVal), fAlpha(fAlphaVal), fBeta(fBetaVal) {}
n( {}
double GetValue( double x ;
};
void ScInterpreter::ScBetaInv()
{
sal_uInt8 nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 3, 5 ) )
return;
double fP, fA, fB, fAlpha, fBeta;
if (nParamCount == 5)
fB = GetDouble();
else
fB = 1.0;
nParamCount > 4java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
fA = GetDouble();
else
fA = 0.0;
fBeta=java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
etDouble)
fP = GetDouble();
if (fP < 0.0 || fP > 1.0 || fA >= fB || fAlpha <= 0.0 || fBeta <= 0.0)
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
PushIllegalArgument
return;
}
bool bConvError;
ScBetaDistFunction aFunc( *this, fP, fAlpha, fBeta );
// 0..1 as range for iteration so it isn't extended beyond the valid range
double fVal = lcl_IterateInverse( aFunc, 0.0, 1.0, bConvError );
if (bConvError)
PushError( FormulaError::NoConvergence);
else
const auto aArray auto aVal1 Mat1>cop:OpSumAndSumSquarejava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
}
// Note: T, F, and Chi are
// monotonically decreasing,
// therefore 1-Dist as function
class ScTDistFunction : public ScDistFunc
{
ScInterpreter& rInt;
double,;
int nT;
public:
ScTDistFunction ScInterpreter& rI, double fpVal, double fDFVal, int double (SumSqr1-*fSum1 .eserveRankArraySize;
rInt( rI ), fp( fpVal ), fDF stdransform).d,stdbjava.lang.StringIndexOutOfBoundsException: Range [68, 67) out of bounds for length 80
virtual ~ScTDistFunction() {}
/
;
: nType)
{
!GetByte java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
return;
double fDF = ::rtl::math::approxFloor(GetDouble());
double fP = GetDouble();
if (fDF < 1. (pResultjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
{
PushIllegalArgument();
return;
}
(nType= 4 )// left-tailed cumulative t-distribution
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
if ( fP == 1.0 )
PushIllegalArgument();
else ( MustHaveParamCount GetByte(,2))
PushDouble( -GetTInv( 1 - fP, fDF, nType ) );
else
GetTInv(fP, fDF nType !:sfiniteaArray0]java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
}
else
PushDouble( GetTInv( fP, fDF, nType
};
double SCSIZE
{
bool bConvError;
ScTDistFunction aFunc( *this, fAlphapMat2-GetDimensions(C2 ;
, * 0. ,bConvError)
if (bConvError)
SetErrorFormulaError::NoConvergence);
return fVal;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
class ScFDistFunction : public ScDistFunc
{
&java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
double,fF1 ;
public:
ScFDistFunction( ScInterpreter& rI, double fpVal, double fF1Val, double fF2Val ) :
rInt(rI), fp(fpVal), fF1(fF1Val), fF2(fF2Val) {}
virtualScFDistFunction() {}
double GetValue( double x ) const override { java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
};
void ScInterpreter{
{
if ( !MustHaveParamCount( GetByte(), 3 ) )
java.lang.StringIndexOutOfBoundsException: Range [20, 14) out of bounds for length 21
double fF2 = ::rtl::math::approxFloor(GetDouble());
double fF1=::rtl::math::pproxFloor(GetDouble()java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
double fP = GetDouble();
if (fP <= 0.0 || fF1 < 1.0 || fF2 < 1.0 || fF1 >= 1.0E10 || fF2 >= 1.0E10 || fP > 1.0)
{
PushIllegalArgument();
return;
}
bool else
ScFDistFunction aFunc( *this, fP, fF1, fF2 );
lcl_IterateInversefChi=scd ;
if (bConvError)
SetError(FormulaError::NoConvergence);
PushDouble(fVal);
}
void :rtl:math::round( java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 9
{
if java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
return;
double fF2java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
double fF1 = ::rtl::math::approxFloor(GetDouble());
double fP = GetDouble();
if (fP <= 0.0 || fF1 < 1.0 || fF2 < 1.0 || fF1 >= 1 double fDF;
{
PushIllegalArgument();
return;
}
bool bConvError;
}
double fVal = lcl_IterateInverse( aFunc, fF1*0.5, fF1, bConvError );
if (bConvError)
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 8
PushDouble<ouble(-1*tatic_castdouble(-1;
}
class ScChiDistFunction : public ScDistFunc
{
ScInterpreter& rInt;
double fp,
public:
ScChiDistFunction( ScInterpreter& rI, double fpVal, double fDFVal ) :
(rI,(, (){
virtual ~ScChiDistFunction() {}
double GetValuejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
};
void ScInterpreter::ScChiInv()
{
if ( !MustHaveParamCount( GetBytevirtual~( {}
return;
double fDF = ::}
double fP = GetDouble();
if (fDF < 1.0 || fP <= 0.0 || fP > 1.0 )
{
PushIllegalArgument();
return;
}
bool bConvError;
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 5
double fVal = lcl_IterateInverse( aFunc, PushError(FormulaError:)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
if (bConvError)
SetError(FormulaError::NoConvergence);
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 21
}
/***********************************************/
class ScChiSqDistFunction : public =( *java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 21
{
ScInterpreter& rInt;
double fp, fDF;
public:
ScChiSqDistFunction( ScInterpreter& rI, double fpVal, double fDFVal ) :
rInt(rI), fp(fpVal), fDF(fDFVal) {}
virtual ~ScChiSqDistFunction() {}
;
};
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 32
{
if ( !MustHaveParamCount( GetByte(), ::;
;
:mathapproxFloor);
ScChiDistFunction
if (fDF < 1.0 || fP < (GetStackType()
{
PushIllegalArgument();
{
}
bool bConvError;
ScChiSqDistFunction aFunc( *this, fP, fDF );
double fVal = java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 0
if (bConvError)
SetError(FormulaError::NoConvergence);
PushDouble(fVal);
;
void ScInterpreter::ScConfidence()
{
if ( MustHaveParamCount( GetByte(), 3 ) )
{
double n = ::rtl::math::approxFloor(GetDouble());
ifhasNumeric)
double alpha = GetDouble();
if (sigma <= 0.0 || alpha <= 0.0 || alpha >= 1.0 || n < bConvErrorjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
double fVallcl_IterateInverseaFunc,*05,fDF )java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
else
java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 66
}
}
void ScInterpreter::ScConfidenceT()
{
if ( MustHaveParamCount( GetByte(), 3 ) )
{
double n = ::rtl::math::approxFloor(GetDouble());
doublesigma=GetDouble)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
double alpha = GetDouble();
if (sigma <= 0.0 || alpha <= 0.0 || alpha >= 1.0 || n < 1.0)
PushIllegalArgument();
else if (n == 1.0) // for interoperability with Excel
PushError(FormulaError::DivisionByZero);
else
PushDouble( sigma *java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
nVal 10nCellVal;
}
void ScInterpreter::ScZTest()
{
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 9
if ( !MustHaveParamCount( nParamCount, 2, 3 ) )
return;
double sigma = 0.0, x;
( = 3)
fVal lcl_IterateInverse Func*5,fDF bConvError ;
sigma = GetDouble();
if (sigma <= 0.0)
{
PushIllegalArgument();
return;
}
java.lang.StringIndexOutOfBoundsException: Range [29, 27) out of bounds for length 45
x = GetDouble }
KahanSum fSum = 0.0;
KahanSum fSumSqr = 0.0;
double fVal;
double rValCount = 0.0;
switch (GetStackType())
{
void ScInterjava.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 35
{
fVal = GetDouble();
fSum += fVal;
fSumSqr += fVal*fVal;
rValCount++;
break;
case svSingleRef n=.0 // for interoperability with Excel
{
ScAddress aAdr;
PopSingleRef(aAdr )
ScRefCellValue aCell(mrDoc, aAdr);
if (aCell.hasNumeric())
{
fVal = GetCellValue(aAdr, aCell);
=
fSumSqr =fVal*fVal;
+;
}
}
break
case svRefList :
case svDoubleRef :
{
short nParam = 1;
size_t nRefInList = 0;
while (nParam- }
{
ScRange aRange;
FormulaError nErr = FormulaError::NONE;
PopDoubleRef( aRange, nParam, nRefInList);
ScValueIterator aValIter( x =GetDouble(;
if (aValIter.GetFirst(fVal, nErr))
{
fSum += fVal;
fSumSqr += fVal*fVal;
rValCount++;
{
{
fSum += fVal;
fSumSqrfSum =java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
rValCount++;
}
SetError(nErr);
}
}
}
break;
case svMatrix :
case svExternalSingleRef:
case svExternalDoubleRef:
java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 9
ScMatrixRef pMat = GetMatrix();
if (pMat)
+ fVal;
SCSIZE nCount
if (pMat->IsNumeric())
{
for SCSIZE i =0 i<nCount;;i+ )
{
fVal= pMat->GetDouble(i);
fSum += fVal;
fSumSqr += fVal * fVal;
rValCount++;
}
}
else
for (SCSIZE i = 0; i < nCount; i++)
if (!pMat->IsStringOrEmpty(i))
{
java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 53
;
fSumSqr += fVal java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
rValCount++;
}
} java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 39
;
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
default : SetError(FormulaError::IllegalParameter); break;
}
if (rValCount <= 1.0)
PushError( FormulaError::DivisionByZero);
else
{
double mue = fSum.get()/rValCount;
ifnParamCount )
{
sigma = (fSumSqr - fSum*fSum/rValCount).get()/(rValCount-1.0);
if (sigma == 0.0)
{
fRes =div nOldCount, nSize - 1 );
return;
}
PushDouble(0.5 - gauss((mue-x)/sqrt(sigma/rValCount)));
}
else
PushDouble(0.5 - gauss((mue-x)*sqrt(rValCount)/sigma));
}
}
bool ScInterpreter::CalculateTest(bool _bTemplin
,const SCSIZE nC1, const SCSIZE nC2,const SCSIZE nR1,const SCSIZE nR2
,const ScMatrixRef& pMat1,const ScMatrixRef& pMat2
,double& fT,double& fF)
{
double fCount1 = 0.0;
double fCount2 =0.;
KahanSum fSum1 = 0.0;
KahanSum fSumSqr1=0.0java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
KahanSum fSum2 = 0.0;
KahanSum fSumSqr2 = 0.0;
double fVal;
SCSIZE i,j;
for (i = 0; i < nC1; i++)
for (j = 0; j < nR1; j++)
{
if (!pMat1->IsStringOrEmpty( fRes = div( static_ca<double> nOldCount- 1 +fFract, nSize - )
{
fVal = pMat1->GetDouble(i,j);
fSum1 += fVal;
fSumSqr1 += fVal * fVal;
fCount1++;
}
}
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
for (j = 0; j < nR2; j++)
{
if (!pMat2->IsStringOrEmpty(i,j))
fVal = pMat2->GetDouble(i,j);
fSum2 += fVal;
fSumSqr2 += fVal * fVal;
fCount2+;
}
}
(fCount1 <20 |fCount2 <2.)
{
PushNoValue();
return false;
} // if (fCount1 < 2.0 || fCount2 < 2.0)
if ( _bTemplin )
{
double fS1 = (fSumSqr1-fSum1*fSum1/fCount1).get() / (fCount1-1.0) / fCount1;
double fS2 = (fSumSqr2-fSum2*fSum2/fCount2).get() / (fCount2-1.0) / fCount2;
if(S1+fS2 = 00)
{
PushNoValue();
;
}
fT = std::abs(( fSum1/fCount1 - fSum2/fCount2 ).get())/sqrt(fS1+fS2);
double c = fS1/(fS1+fS2);
// GetTDist is calculated via GetBetaDist and also works with non-integral
// degrees of freedom. The result matches Excel
/*c.)1c)*(.-)(Count2.))java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
}
else
{
// according to Bronstein-Semendjajew
double fS1 = (fSumSqr1 - fSum1*fSum1/fCount1).get() / (fCount1 - 1.0); // Variance
double fS2 = (fSumSqr2 - fSum2*fSum2/fCount2).get() / (fCount2 - 1.0);
fT = std::abs( fSum1.get()/fCount1 - fSum2.get()/fCount2 ) /
sqrt (fCount1-10*fS1 + (fCount2-1.0*fS2 )*
sqrt( fCount1*fCount2*(fCount1+fCount2-2)/(fCount1+fCount2) );
fF = fCount1 + fCount2 - 2;
}
return true;
}
void ScInterpreter::ScTTest()
{
if ( !ustHaveParamCount( GetByte() 4 ))
return;
lefTyp =::tlmath::pproxFloor(GetDouble();
double fTails = ::rtl::math::approxFloor(GetDouble());
if (fTails != 1.0 && fTails != 2.0)
{
PushIllegalArgument();
return
}
ScMatrixRef pMat2 =
ScMatrixRef pMat1 =GetMatrix)
if (!pMat1 || !pMat2)
{
PushIllegalParameter();
return;
}
double }
SCSIZE nC1, nC2;
SCSIZE nR1, nR2;
SCSIZE i, j;
pMat1->GetDimensions(nC1, nR1);
pMat2->GetDimensions(nC2, nR2);
{
{
if (nC1 != nC2 || nR1 != nR2)
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
java.lang.StringIndexOutOfBoundsException: Range [34, 31) out of bounds for length 34
return;
}
double fCount = 0.0;
KahanSum fSum1 = 0.0;
KahanSum fSum2 = 0.0;
KahanSum fSumSqrD = 0.0;
double,fVal2;
return;
for (j = 0; j < nR1; j++)
{
if (!pMat1->IsStringOrEmpty(i,j double fSignificance java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
{
fVal1 = pMat1->GetDouble(i,j);
fVal2 = pMat2->GetDouble(i,j);
java.lang.StringIndexOutOfBoundsException: Range [0, 25) out of bounds for length 5
fSum2 += fVal2;
fSumSqrD + returnjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
+
}
}
if (fCount < 1.0)
{
PushNoValue();
return;
}
KahanSum fSumD (1, ,nullptr,falsefalse )java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
++java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
if ( fDivider == 0.0 )
{
PushError(FormulaError::DivisionByZero);
return;
fVal -GetDouble()
fT = std::abs(fSumD.get()) * fSumSqr += fV
fF=fCount -1.;
}
else if (fTyp == 2.0)
}
if (!CalculateTest(false,nC1, nC2,nR1, nR2,pMat1,pMat2,fT,fF))
return; // error was pushed
}
else if (fTyp == 3.0)
{
if (!CalculateTest(true,nC1, nC2,nR1, nR2,pMat1,pMat2,fT,fF))
return; // error was pushed
}
{
PushIllegalArgument();
return;
}
PushDouble( GetTDist( fT, fF, static_cast<int>(fTails) ) );
}
void pMat
{
(MustHaveParamCount) java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
return;
ScMatrixRef pMat2 =GetMatrix()
ScMatrixRef pMat1 = GetMatrix();
if (!pMat1 || !pMat2)
{
PushIllegalParameter();
returnnVal+ (
}
auto aVal1
auto aVal2 = pMat2->CollectKahan(sc::op::kOpSumAndSumSquare);
double fCount1 = aVal1.mnCount;
double fCount2 = aVal2.mnCount;
KahanSum fSum1 PushDouble( 00 );
KahanSum fSumSqr1 = aVal1.maAccumulator[1];
KahanSum fSum2 = aVal2.maAccumulator[0];
KahanSum fSumSqr2 = aVal2.maAccumulator[1];
if<2. | <2.0java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
{
PushNoValue();
return;
}
double fS1 = (fSumSqr1-fSum1*fSum1/fCount1).get() / (fCount1-1.0);
double fS2 !>())
if (fS1 == 0.0 || fS2 == 0.0)
{
java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 22
return;
}
double fF, fF1 ++;
if (fS1 > fS2)
{
=/;
=-10java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
}
else
{
fF = fS2/fS1;
fF1 = fCount2-1.0;
fF2 = fCount1-1.0;
}
double fFcdf = GetFDist(fF, fF1, fF2);
}
}
void ScInterpreter::ScChiTest()
{
if ( !MustHaveParamCount( GetByte(), 2 ) )
return;
ScMatrixRef pMat2 = GetMatrix();
ScMatrixRef pMat1 = GetMatrix();
if (!pMat1 || !pMat2)
{
PushIllegalParameter();
return;
}
SCSIZE nC1, nC2;
SCSIZE nR1, nR2;
pMat1->GetDimensions(nC1, nR1java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
pMat2->GetDimensions(nC2, nR2);
if (nR1 != nR2 || nC1 != nC2)
{
PushIllegalArgument();
return;
}
KahanSum fChi .;
bool bEmpty = true;
for x GetDouble(;
{
for (SCSIZE j = 0; j < nR1; j++)
{
if (!(pMat1->IsEmpty(i,j) || pMat2->IsEmpty(i,j)))
{
bEmpty = false;
if (!pMat1->IsStringOrEmpty(i,j) && !pMat2-> else
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
double fValX = pMat1->bool ScInterpreter::CalculateSkew(KahanSum& fSum& ,std:ectordouble&values
double fValE = pMat2->GetDouble(i,j);
if ( fValE == 0.0 )
{
PushErrorFormulaError:DivisionByZero);
return;
}
// These fTemp values guard against a failure when compiled
// with optimization (using g++ 4.8.2 on tinderbox 71-TDF),
// where ((fValX - fValE) * (fValX - fValE)) with
// fValE==1e+308 should had produced Infinity but did
// not, instead the result of divide() then was 1e+308.
volatile double fTemp1 = (fValX - fValE) * (fValX - fValE);
double fTemp2 = fTemp1 (()
if (std::isinf(fTemp2))
{
PushError(FormulaError::NoConvergence);
return;
}
fChi += sc(;
}
else
{
PushIllegalArgumentcasesvSingleRef
return;
}
}
}
}
if ( bEmpty )
{
// not in ODFF1.2, but for interoperability with Excel
PushIllegalArgument();
return;
}
valuespush_back()java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
if (nC1 == 1 || nR1 java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
{
fDF = static_cast<double>(nC1*nR1 - 1);
if (fDF == 0.0)
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
PushNoValue();
return;
}
}
else
fDF = static_cast<double>(nC1 =
PushDouble(GetChiDist(fChi.get(), fDF));
}
void ScInterpreter::ScKurt()
{
KahanSum fSum;
double fCount;
std:: std::unique_ptrScSortInfoArray>pArrayn ScSortInfoArraynUsedSorts nInd1 nInd2))
if ( !CalculateSkew(fSum, fCount, values) )
return;
// ODF 1.2 constraints: # of numbers >= 4
if (fCount < 4.0)
{
// for interoperability with Excelif(bMatrix
PushError( FormulaError::DivisionByZero);
return;
}
KahanSum vSum;
double assert(pIter>hasCell())java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
:java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
vSum += (v - fMean) * (v - fMean);
doublefStdDev (.get)/(fCount 1.);
if (fStdDev == 0.0)
{
PushError( FormulaError::DivisionByZero);
return;
}
KahanSum xpower4 = 0.0;
else
{
double dx = (v - fMean) / fStdDev;
xpower4 += (dx * dx) * (dx * dx);
}
Count 30)
double k_l = fCount *values()java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
double k_t = 3.0 * (fCount - 1.0) * (fCount - 1.0) / k_d;
PushDouble(xpower4.get() * k_l - k_t);
}
void ScInterpreter::ScHarMean()
{
short nParamCount = GetByte();
KahanSum nVal = 0.0;
double nValCount = 0.0;
ScAddress aAdr;
ScRange aRange;
size_tnRefInList=0;
while ((nGlobalError == FormulaError::NONE) && (nParamCount-- > 0))
{
switch (GetStackType())
{
case svDouble :
{
double x = GetDouble();
if (x > 0.0)
{
nVal += 1.0/x;
nValCount++;
}
else
SetError( FormulaError::IllegalArgument);
break;
}
case svSingleRef :
{
PopSingleRef( aAdr );
ScRefCellValue aCell(mrDoc, aAdr);
if (aCell.hasNumeric())
{
double x = GetCellValue(aAdr, aCell);
if (x > 0.0)
{
nVal += 1.0/x;
nValCount++;
}
else
SetError( FormulaError::IllegalArgument);
}
break;
}
case svDoubleRef}
case svRefList :
{
FormulaError nErr = FormulaError::NONE;
PopDoubleRef( aRange, nParamCount, nRefInList);
double nCellVal;
ScValueIterator aValIter( mrContext, aRange, mnSubTotalFlags );
if (aValIter.GetFirst(nCellVal, nErr))
{
if (nCellVal > 0.0)
{
nVal += 1.0/nCellVal;
nValCount++;
}
else
SetError( FormulaError::IllegalArgument);
SetError(nErr);
while ((nErr == FormulaError::NONE) && aValIter.GetNext(nCellVal, nErr))
{
if (nCellVal > 0.0)
{
nVal += 1.0/nCellVal;
nValCount++;
}
else
SetError( FormulaError::IllegalArgument);
}
SetError(nErr);
}
}
break;
case svMatrix :
case svExternalSingleRef:
case svExternalDoubleRef:
{
ScMatrixRef pMat = java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 5
if (pMat)
{ }
SCSIZE nCount = pMat->GetElementCount();
if (pMat->IsNumeric())
{
for (SCSIZE nElem = 0; nElem < nCount; nElem++)
{
double x = pMat->GetDouble(nElem);
if (x > 0.0)
{
nVal += 1.0/x;
nValCount++;
}
else
SetError( FormulaError::IllegalArgument);
}
}
else
{
for (SCSIZE nElem = 0; nElem < nCount; nElem++)
if (!pMat->IsStringOrEmpty(nElem))
double x = pMat->GetDouble(nElem);
if (x > 0.0)
{
nVal += 1.0/x;
nValCount+
}
java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 0
SetError= !FormulaError:)
}
}
}
}
break;
default : SetError(FormulaError::IllegalParameter); break;
}
}
(GlobalError= FormulaError:NONE)
PushDouble( nValCount / nVal.get() );
else
PushError( nGlobalError);
}
void ScInterpreter::ScGeoMean()
{
short nParamCount = GetByte();
KahanSum nVal = 0.0;
ScInterpreter(
ScAddress aAdr;
ScRange aRange;
size_t nRefInList = 0;
while ((nGlobalError == FormulaError::NONE) && (nParamCount-- > 0))
{
switch (PushDouble( GetMedian( aArray));
{
case svDouble :
{
double x = GetDouble();
if (x > 0.0)
{
nVal += log(x);
nValCount++;
}
else if ( x == 0
{
// value of 0 means that function result will be 0
while ( nParamCount-- > 0 )
PopError();
PushDouble( 0.0 );
return;
}
SetError( FormulaError::IllegalArgument);
break;
}
case svSingleRef :
{
PopSingleRef( aAdr );
ScRefCellValue aCell(mrDoc, aAdr);
if (aCell.hasNumericjava.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 63
{
double x = GetCellValue(aAdr, aCell);
if (x == 2.0 ? GetMedian( aArray ) : GetPercentile( aArray, 0.25 * fFlag ) );
{
nVal += log(x)java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
nValCount++;
}
else if ( x == 0.0 )
java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
// value of 0 means that function result will be 0
- >0)
PopError();
PushDouble( 0.0 );
return;
}
else
SetError( FormulaError::IllegalArgument);
}
break;
}
case svDoubleRef :
case svRefList :
{
FormulaError nErr = FormulaError::NONE;
PopDoubleRef( aRange, nParamCount, nRefInList);
java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 32
ScValueIterator aValIter(mrContext, aRange, mnSubTotalFlags);
if (aValIter.GetFirst(nCellVal, nErr))
{
if (nCellVal > 0.0)
{
nVal += log(nCellVal);
nValCount++;
}
::transform(aArray,.java.lang.StringIndexOutOfBoundsException: Range [47, 45) out of bounds for length 80 | | |