Kaydet (Commit) 9f397368 authored tarafından Wolfgang Pechlaner's avatar Wolfgang Pechlaner Kaydeden (comit) Norbert Thiebaud

fdo#40759 Fix GAMMADIST() result for x=0

üst 9e126721
...@@ -152,8 +152,25 @@ double ScInterpreter::GetUpRegIGamma( double fA, double fX ) ...@@ -152,8 +152,25 @@ double ScInterpreter::GetUpRegIGamma( double fA, double fX )
double ScInterpreter::GetGammaDistPDF( double fX, double fAlpha, double fLambda ) double ScInterpreter::GetGammaDistPDF( double fX, double fAlpha, double fLambda )
{ {
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetGammaDistPDF" ); RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetGammaDistPDF" );
if (fX <= 0.0) if (fX < 0.0)
return 0.0; // see ODFF return 0.0; // see ODFF
else if (fX == 0)
// in this case 0^0 isn't zero
{
if (fAlpha < 1.0)
{
SetError(errDivisionByZero); // should be #DIV/0
return HUGE_VAL;
}
else if (fAlpha == 1)
{
return (1.0 / fLambda);
}
else
{
return 0.0;
}
}
else else
{ {
double fXr = fX / fLambda; double fXr = fX / fLambda;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment