[Libreoffice-commits] .: sc/source
Norbert Thiebaud
nthiebaud at kemper.freedesktop.org
Mon Sep 12 03:37:19 PDT 2011
sc/source/core/tool/interpr6.cxx | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
New commits:
commit 9f397368cce0b94f76d4f1d74150ccc75c498e8b
Author: Wolfgang Pechlaner <libo at pechlaner.at>
Date: Mon Sep 12 05:36:51 2011 -0500
fdo#40759 Fix GAMMADIST() result for x=0
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index abd6f18..573a4d7 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -152,8 +152,25 @@ double ScInterpreter::GetUpRegIGamma( double fA, double fX )
double ScInterpreter::GetGammaDistPDF( double fX, double fAlpha, double fLambda )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetGammaDistPDF" );
- if (fX <= 0.0)
+ if (fX < 0.0)
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
{
double fXr = fX / fLambda;
More information about the Libreoffice-commits
mailing list