[PATCH] modified: sc/source/core/tool/interpr6.cxx

Wolfgang Pechlaner (none) wope at melmak.
Mon Sep 12 01:52:12 PDT 2011


---
 sc/source/core/tool/interpr6.cxx |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index abd6f18..df5a4be 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;
-- 
1.7.3.4


--------------030007050901080500050503--


More information about the LibreOffice mailing list