summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2018-07-12 18:02:54 +0900
committerEike Rathke <erack@redhat.com>2018-07-26 02:00:14 +0200
commitf30afe009e9e9da32dfc0aa1490d1f7ce787d101 (patch)
tree22489ba0fdf99ea3324f46ee30fb4793372ee95b /sc
parent75a5b5a850511bf1a0a32c113237085cbc069cc4 (diff)
sc: Make CONFIDENCE.T() raise #DIV/0! when size is 1
... for interoperability with Excel, as remarked in <https://support.office.com/en-us/article/CONFIDENCE-T-function-E8ECA395-6C3A-4BA9-9003-79CCC61D3C53>. Change-Id: I2d24573055455fa014c38f6e5985e3501ed6ba6e Reviewed-on: https://gerrit.libreoffice.org/57322 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/functions/statistical/fods/confidence.t.fods8
-rw-r--r--sc/source/core/tool/interpr3.cxx2
2 files changed, 6 insertions, 4 deletions
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 @@
</table:table-row>
<table:table-row table:style-name="ro7">
<table:table-cell table:formula="of:=COM.MICROSOFT.CONFIDENCE.T(0.05;1.5;1)" office:value-type="string" office:string-value="" calcext:value-type="error">
- <text:p>Err:523</text:p>
+ <text:p>#DIV/0!</text:p>
</table:table-cell>
- <table:table-cell office:value-type="string" calcext:value-type="string">
- <text:p>Err:523</text:p>
+ <table:table-cell table:formula="of:#DIV/0!" office:value-type="string" office:string-value="" calcext:value-type="error">
+ <text:p>#DIV/0!</text:p>
</table:table-cell>
- <table:table-cell table:style-name="ce23" table:formula="of:=ISERROR([.A10])" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
+ <table:table-cell table:style-name="ce23" table:formula="of:=ERROR.TYPE([.A10])=2" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean">
<text:p>TRUE</text:p>
</table:table-cell>
<table:table-cell table:style-name="ce30" table:formula="of:=FORMULA([.A10])" office:value-type="string" office:string-value="=CONFIDENCE.T(0.05,1.5,1)" calcext:value-type="string">
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 ) );
}