From f30afe009e9e9da32dfc0aa1490d1f7ce787d101 Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Thu, 12 Jul 2018 18:02:54 +0900 Subject: sc: Make CONFIDENCE.T() raise #DIV/0! when size is 1 ... for interoperability with Excel, as remarked in . Change-Id: I2d24573055455fa014c38f6e5985e3501ed6ba6e Reviewed-on: https://gerrit.libreoffice.org/57322 Tested-by: Jenkins Reviewed-by: Eike Rathke --- sc/qa/unit/data/functions/statistical/fods/confidence.t.fods | 8 ++++---- sc/source/core/tool/interpr3.cxx | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'sc') diff --git a/sc/qa/unit/data/functions/statistical/fods/confidence.t.fods b/sc/qa/unit/data/functions/statistical/fods/confidence.t.fods index b1131857129a..fd8cf4491c28 100644 --- a/sc/qa/unit/data/functions/statistical/fods/confidence.t.fods +++ b/sc/qa/unit/data/functions/statistical/fods/confidence.t.fods @@ -3016,12 +3016,12 @@ - Err:523 + #DIV/0! - - Err:523 + + #DIV/0! - + TRUE diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index 78756b0810e8..689ea4e4de59 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -2434,6 +2434,8 @@ void ScInterpreter::ScConfidenceT() 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 * GetTInv( alpha, n - 1, 2 ) / sqrt( n ) ); } -- cgit