diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2018-07-26 16:42:31 +0900 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-08-15 13:11:17 +0200 |
commit | 992242a15c3f6cc6aed55fa2a4177d80d33a7277 (patch) | |
tree | c27aefd982bffb5b53cf3de11ad5bd95204c3ef3 /sc | |
parent | 64474264443a83a341c161bbcc6592073a1728f9 (diff) |
sc: Report #DIV/0! when MOD()'s divisor is 0
as Excel does [1], while ODF 1.2 does not specify which kind of
error should be assigned for that case.
[1] https://support.office.com/en-us/article/mod-function-9b6cd169-b6ee-406a-a97b-edf2a9dc24f3
Change-Id: Id6ebf790ac407f2a8b8769fc0518f136a1271a3d
Reviewed-on: https://gerrit.libreoffice.org/58351
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/functions/mathematical/fods/mod.fods | 8 | ||||
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/sc/qa/unit/data/functions/mathematical/fods/mod.fods b/sc/qa/unit/data/functions/mathematical/fods/mod.fods index 7148b59df4b7..262f4fff02f9 100644 --- a/sc/qa/unit/data/functions/mathematical/fods/mod.fods +++ b/sc/qa/unit/data/functions/mathematical/fods/mod.fods @@ -3220,12 +3220,12 @@ </table:table-row> <table:table-row table:style-name="ro5"> <table:table-cell table:formula="of:=MOD(25.4;0)" office:value-type="string" office:string-value="" calcext:value-type="error"> - <text:p>Err:502</text:p> + <text:p>#DIV/0!</text:p> </table:table-cell> - <table:table-cell office:value-type="string" calcext:value-type="string"> - <text:p>Err502</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="ce66" table:formula="of:=ISERROR([.A36])" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <table:table-cell table:style-name="ce66" table:formula="of:=ERROR.TYPE([.A36])=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="ce21" table:formula="of:=FORMULA([Sheet2.A36])" office:value-type="string" office:string-value="=MOD(25.4,0)" calcext:value-type="string"> diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index f6560dcb95ab..c185ecfe9223 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -2368,7 +2368,7 @@ void ScInterpreter::ScMod() double fDenom = GetDouble(); // Denominator if ( fDenom == 0.0 ) { - PushIllegalArgument(); + PushError(FormulaError::DivisionByZero); return; } double fNum = GetDouble(); // Numerator |