[Libreoffice-commits] core.git: sc/source

Takeshi Abe tabe at fixedpoint.jp
Mon Jun 11 11:01:03 UTC 2018


 sc/source/core/tool/interpr3.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit d17e8faa13b1f8d943b602aa6ea754c1b22fdd76
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Fri Jun 1 12:40:11 2018 +0900

    sc: Make ZTEST() raise #DIV/0! when the sample stddev is 0
    
    because it is an actual division-by-zero error and Excel does.
    
    Call for suggestion: I would like to add a test case to
    sc/qa/unit/data/functions/statistical/fods/ztest.fods, but
    do not know the right manner of adding it cleanly without
    messing up other parts such as styles.
    
    Change-Id: I79b99a6b7385177e94d75bb4e00d724332b9b8bf
    Reviewed-on: https://gerrit.libreoffice.org/55152
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index a43ec7835193..8c433bab587c 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -2560,6 +2560,11 @@ void ScInterpreter::ScZTest()
         if (nParamCount != 3)
         {
             sigma = (fSumSqr - fSum*fSum/rValCount)/(rValCount-1.0);
+            if (sigma == 0.0)
+            {
+                PushError(FormulaError::DivisionByZero);
+                return;
+            }
             PushDouble(0.5 - gauss((mue-x)/sqrt(sigma/rValCount)));
         }
         else


More information about the Libreoffice-commits mailing list