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(-)

New commits:
commit f30afe009e9e9da32dfc0aa1490d1f7ce787d101
Author:     Takeshi Abe <t...@fixedpoint.jp>
AuthorDate: Thu Jul 12 18:02:54 2018 +0900
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Thu Jul 26 02:00:14 2018 +0200

    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 <er...@redhat.com>

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 ) );
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to