summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinfried Donkers <winfrieddonkers@libreoffice.org>2018-05-02 15:51:48 +0200
committerEike Rathke <erack@redhat.com>2018-05-03 13:50:55 +0200
commit5cee94308b8dbceb11de4ac02e1d7c9808ccdb02 (patch)
tree2185107eff717a3630bf82802bb1a1960efa135e
parente56702c41bc84a4ddeaad23a59b66aee6bd35a6c (diff)
tdf#117041 use correct expression in if statement.
Follow up of commit e58b3f987681d0034f692db82345af06de217836. Change-Id: Ia142ae401a8c86e3411830703794eedb351bca09 Reviewed-on: https://gerrit.libreoffice.org/53733 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods145
-rw-r--r--sc/source/core/tool/interpr3.cxx2
2 files changed, 146 insertions, 1 deletions
diff --git a/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods b/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods
index 86e67be89a36..4b57e0150907 100644
--- a/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/hypgeomdist.fods
@@ -4469,6 +4469,151 @@
<table:table-cell table:number-columns-repeated="2"/>
</table:table-row>
<table:table-row table:style-name="ro9">
+ <table:table-cell table:style-name="ce10" table:formula="of:=HYPGEOMDIST(2;4;1;10;1)" office:value-type="float" office:value="1" calcext:value-type="float">
+ <text:p>1</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="1" calcext:value-type="float">
+ <text:p>1</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="ce54" table:formula="of:=ROUND([.A34];12)=ROUND([.B34];12)" 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="ce21" table:formula="of:=FORMULA([.A34])" office:value-type="string" office:string-value="=HYPGEOMDIST(2,4,1,10,1)" calcext:value-type="string">
+ <text:p>=HYPGEOMDIST(2,4,1,10,1)</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="string" calcext:value-type="string">
+ <text:p>tdf117041</text:p>
+ </table:table-cell>
+ <table:table-cell table:number-columns-repeated="16"/>
+ <table:table-cell table:style-name="ce33"/>
+ <table:table-cell table:style-name="ce35"/>
+ <table:table-cell table:style-name="ce26"/>
+ <table:table-cell/>
+ <table:table-cell table:style-name="ce36"/>
+ <table:table-cell/>
+ <table:table-cell table:style-name="ce26" table:number-columns-repeated="2"/>
+ <table:table-cell table:number-columns-repeated="2"/>
+ <table:table-cell table:style-name="ce36"/>
+ <table:table-cell table:style-name="ce37"/>
+ <table:table-cell table:number-columns-repeated="2"/>
+ </table:table-row>
+ <table:table-row table:style-name="ro9">
+ <table:table-cell table:style-name="ce10" table:formula="of:=HYPGEOMDIST(2;4;1;10;0)" office:value-type="float" office:value="0" calcext:value-type="float">
+ <text:p>0</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="0" calcext:value-type="float">
+ <text:p>0</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="ce54" table:formula="of:=ROUND([.A35];12)=ROUND([.B35];12)" 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="ce21" table:formula="of:=FORMULA([.A35])" office:value-type="string" office:string-value="=HYPGEOMDIST(2,4,1,10,1)" calcext:value-type="string">
+ <text:p>=HYPGEOMDIST(2,4,1,10,1)</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="string" calcext:value-type="string">
+ <text:p>tdf117041</text:p>
+ </table:table-cell>
+ <table:table-cell table:number-columns-repeated="16"/>
+ <table:table-cell table:style-name="ce33"/>
+ <table:table-cell table:style-name="ce35"/>
+ <table:table-cell table:style-name="ce26"/>
+ <table:table-cell/>
+ <table:table-cell table:style-name="ce36"/>
+ <table:table-cell/>
+ <table:table-cell table:style-name="ce26" table:number-columns-repeated="2"/>
+ <table:table-cell table:number-columns-repeated="2"/>
+ <table:table-cell table:style-name="ce36"/>
+ <table:table-cell table:style-name="ce37"/>
+ <table:table-cell table:number-columns-repeated="2"/>
+ </table:table-row>
+ <table:table-row table:style-name="ro9">
+ <table:table-cell table:style-name="ce10" table:formula="of:=HYPGEOMDIST(1;4;1;10;0)" office:value-type="float" office:value="0.4" calcext:value-type="float">
+ <text:p>0.4</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="0.4" calcext:value-type="float">
+ <text:p>0.4</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="ce54" table:formula="of:=ROUND([.A36];12)=ROUND([.B36];12)" 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="ce21" table:formula="of:=FORMULA([.A36])" office:value-type="string" office:string-value="=HYPGEOMDIST(1,4,1,10;0)" calcext:value-type="string">
+ <text:p>=HYPGEOMDIST(1,4,1,10,0)</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="string" calcext:value-type="string">
+ <text:p>tdf117041</text:p>
+ </table:table-cell>
+ <table:table-cell table:number-columns-repeated="16"/>
+ <table:table-cell table:style-name="ce33"/>
+ <table:table-cell table:style-name="ce35"/>
+ <table:table-cell table:style-name="ce26"/>
+ <table:table-cell/>
+ <table:table-cell table:style-name="ce36"/>
+ <table:table-cell/>
+ <table:table-cell table:style-name="ce26" table:number-columns-repeated="2"/>
+ <table:table-cell table:number-columns-repeated="2"/>
+ <table:table-cell table:style-name="ce36"/>
+ <table:table-cell table:style-name="ce37"/>
+ <table:table-cell table:number-columns-repeated="2"/>
+ </table:table-row>
+ <table:table-row table:style-name="ro9">
+ <table:table-cell table:style-name="ce10" table:formula="of:=HYPGEOMDIST(1;4;4;6;0)" office:value-type="float" office:value="0" calcext:value-type="float">
+ <text:p>0</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="0" calcext:value-type="float">
+ <text:p>0</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="ce54" table:formula="of:=ROUND([.A37];12)=ROUND([.B37];12)" 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="ce21" table:formula="of:=FORMULA([.A37])" office:value-type="string" office:string-value="=HYPGEOMDIST(1,4,4,6,0)" calcext:value-type="string">
+ <text:p>=HYPGEOMDIST(1,4,4,6,0)</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="string" calcext:value-type="string">
+ <text:p>tdf117041</text:p>
+ </table:table-cell>
+ <table:table-cell table:number-columns-repeated="16"/>
+ <table:table-cell table:style-name="ce33"/>
+ <table:table-cell table:style-name="ce35"/>
+ <table:table-cell table:style-name="ce26"/>
+ <table:table-cell/>
+ <table:table-cell table:style-name="ce36"/>
+ <table:table-cell/>
+ <table:table-cell table:style-name="ce26" table:number-columns-repeated="2"/>
+ <table:table-cell table:number-columns-repeated="2"/>
+ <table:table-cell table:style-name="ce36"/>
+ <table:table-cell table:style-name="ce37"/>
+ <table:table-cell table:number-columns-repeated="2"/>
+ </table:table-row>
+ <table:table-row table:style-name="ro9">
+ <table:table-cell table:style-name="ce10" table:formula="of:=HYPGEOMDIST(2;4;4;6;1)" office:value-type="float" office:value="0.4" calcext:value-type="float">
+ <text:p>0.4</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="0.4" calcext:value-type="float">
+ <text:p>0.4</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="ce54" table:formula="of:=ROUND([.A38];12)=ROUND([.B38];12)" 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="ce21" table:formula="of:=FORMULA([.A38])" office:value-type="string" office:string-value="=HYPGEOMDIST(2,4,4,6,0)" calcext:value-type="string">
+ <text:p>=HYPGEOMDIST(2,4,4,6,0)</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="string" calcext:value-type="string">
+ <text:p>tdf117041</text:p>
+ </table:table-cell>
+ <table:table-cell table:number-columns-repeated="16"/>
+ <table:table-cell table:style-name="ce33"/>
+ <table:table-cell table:style-name="ce35"/>
+ <table:table-cell table:style-name="ce26"/>
+ <table:table-cell/>
+ <table:table-cell table:style-name="ce36"/>
+ <table:table-cell/>
+ <table:table-cell table:style-name="ce26" table:number-columns-repeated="2"/>
+ <table:table-cell table:number-columns-repeated="2"/>
+ <table:table-cell table:style-name="ce36"/>
+ <table:table-cell table:style-name="ce37"/>
+ <table:table-cell table:number-columns-repeated="2"/>
+ </table:table-row>
+ <table:table-row table:style-name="ro9">
<table:table-cell table:number-columns-repeated="2"/>
<table:table-cell table:style-name="ce16"/>
<table:table-cell table:style-name="ce21"/>
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 2a9535e31c8d..b52a62fd3d20 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -1868,7 +1868,7 @@ void ScInterpreter::ScHypGeomDist( int nMinParamCount )
for ( int i = ( bCumulative ? 0 : x ); i <= x && nGlobalError == FormulaError::NONE; i++ )
{
- if ( (i >= n - N + M) || (i >= M) )
+ if ( (n - i <= N - M) && (i <= M) )
fVal += GetHypGeomDist( i, n, M, N );
}