summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinfried Donkers <winfrieddonkers@libreoffice.org>2017-11-12 11:47:11 +0100
committerEike Rathke <erack@redhat.com>2017-11-13 18:28:10 +0100
commit76c2e3efe751d42f7b352bebdddfe33bd37d9e06 (patch)
tree005fa1bb103ccf71a47d20f707998e305375ed33
parent3dee7948c732faf488846d4d3d1237e89afde28c (diff)
tdf#113768 Fix opposite argument description for Calc function VDB.
Also, use self-explaining variable name for argument NoSwitch. Added use of argument NoSwitch to unit test document. Change-Id: I801d4dbd489898b28543e0eb46f74717671ea03a Reviewed-on: https://gerrit.libreoffice.org/44647 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/inc/scfuncs.hrc4
-rw-r--r--sc/qa/unit/data/functions/financial/fods/vdb.fods53
-rw-r--r--sc/source/core/opencl/opinlinefun_finacial.cxx6
-rw-r--r--sc/source/core/tool/interpr2.cxx8
4 files changed, 61 insertions, 10 deletions
diff --git a/sc/inc/scfuncs.hrc b/sc/inc/scfuncs.hrc
index 30103bbf961c..0d3999899ee8 100644
--- a/sc/inc/scfuncs.hrc
+++ b/sc/inc/scfuncs.hrc
@@ -624,8 +624,8 @@ const char* SC_OPCODE_VBD_ARY[] =
NC_("SC_OPCODE_VBD", "End. The last period of the depreciation using the same time unit as for the useful life."),
NC_("SC_OPCODE_VBD", "Factor"),
NC_("SC_OPCODE_VBD", "Factor. The factor for the reduction of the depreciation. Factor = 2 denotes double rate depreciation."),
- NC_("SC_OPCODE_VBD", "Type"),
- NC_("SC_OPCODE_VBD", "Do not alter. Type = 1 denotes switch to linear depreciation, type = 0 do not switch.")
+ NC_("SC_OPCODE_VBD", "NoSwitch"),
+ NC_("SC_OPCODE_VBD", "NoSwitch = 0 denotes switch to linear depreciation, NoSwitch = 1 do not switch.")
};
// -=*# Resource for function EFFECT #*=-
diff --git a/sc/qa/unit/data/functions/financial/fods/vdb.fods b/sc/qa/unit/data/functions/financial/fods/vdb.fods
index 734c0e4c7db2..aee00996327e 100644
--- a/sc/qa/unit/data/functions/financial/fods/vdb.fods
+++ b/sc/qa/unit/data/functions/financial/fods/vdb.fods
@@ -3665,6 +3665,57 @@
<table:table-cell table:style-name="ce32"/>
<table:table-cell table:number-columns-repeated="9"/>
</table:table-row>
+ <table:table-row table:style-name="ro6">
+ <table:table-cell table:formula="of:=VDB(100000;20000;10;4;5;1;0)" office:value-type="float" office:value="7557.14285714286" calcext:value-type="float">
+ <text:p>7557.14285714286</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="7557.14285714286" calcext:value-type="float">
+ <text:p>7557.14285714286</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="ce19" table:formula="of:=ROUND([.A72];12)=ROUND([.B72];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([.A72])" office:value-type="string" office:string-value="=VDB(100000;20000;10;4;5;1;0)" calcext:value-type="string">
+ <text:p>=VDB(100000;20000;10;4;5;1;0)</text:p>
+ </table:table-cell>
+ <table:table-cell table:number-columns-repeated="6"/>
+ <table:table-cell table:style-name="ce32"/>
+ <table:table-cell table:number-columns-repeated="9"/>
+ </table:table-row>
+ <table:table-row table:style-name="ro6">
+ <table:table-cell table:formula="of:=VDB(100000;20000;10;4;5;1;1)" office:value-type="float" office:value="6560.99999999999" calcext:value-type="float">
+ <text:p>6560.99999999999</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="6560.99999999999" calcext:value-type="float">
+ <text:p>6560.99999999999</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="ce19" table:formula="of:=ROUND([.A73];12)=ROUND([.B73];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([.A73])" office:value-type="string" office:string-value="=VDB(100000;20000;10;4;5;1;1)" calcext:value-type="string">
+ <text:p>=VDB(100000;20000;10;4;5;1;1)</text:p>
+ </table:table-cell>
+ <table:table-cell table:number-columns-repeated="6"/>
+ <table:table-cell table:style-name="ce32"/>
+ <table:table-cell table:number-columns-repeated="9"/>
+ </table:table-row>
+ <table:table-row table:style-name="ro6">
+ <table:table-cell table:formula="of:=VDB(100000;20000;10;4;5;1)" office:value-type="float" office:value="7557.14285714286" calcext:value-type="float">
+ <text:p>7557.14285714286</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="7557.14285714286" calcext:value-type="float">
+ <text:p>7557.14285714286</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="ce19" table:formula="of:=ROUND([.A74];12)=ROUND([.B74];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([.A74])" office:value-type="string" office:string-value="=VDB(100000;20000;10;4;5;1)" calcext:value-type="string">
+ <text:p>=VDB(100000;20000;10;4;5;1)</text:p>
+ </table:table-cell>
+ <table:table-cell table:number-columns-repeated="6"/>
+ <table:table-cell table:style-name="ce32"/>
+ <table:table-cell table:number-columns-repeated="9"/>
+ </table:table-row>
<table:table-row table:style-name="ro6" table:number-rows-repeated="164">
<table:table-cell table:style-name="ce15" table:number-columns-repeated="2"/>
<table:table-cell table:style-name="ce20"/>
@@ -3753,4 +3804,4 @@
</table:named-expressions>
</office:spreadsheet>
</office:body>
-</office:document> \ No newline at end of file
+</office:document>
diff --git a/sc/source/core/opencl/opinlinefun_finacial.cxx b/sc/source/core/opencl/opinlinefun_finacial.cxx
index 38eb41db02db..6093583dc87c 100644
--- a/sc/source/core/opencl/opinlinefun_finacial.cxx
+++ b/sc/source/core/opencl/opinlinefun_finacial.cxx
@@ -1532,18 +1532,18 @@ std::string ScInterVDB=
std::string VDBImplementDecl=
"double VDBImplement(double fCost, double fSalvage, double fLife, double fStart"
-", double fEnd, double fFactor, int nType);\n";
+", double fEnd, double fFactor, bool bNoSwitch);\n";
std::string VDBImplement=
"double VDBImplement(double fCost, double fSalvage, double fLife, double fStart"
-", double fEnd, double fFactor, int nType)\n"
+", double fEnd, double fFactor, bool bNoSwitch)\n"
"{\n"
" double result=0;\n"
" double fIntStart = floor(fStart);\n"
" double fIntEnd = ceil(fEnd);\n"
" int nLoopStart = (int) fIntStart;\n"
" int nLoopEnd = (int) fIntEnd;\n"
-" if (nType)\n"
+" if (bNoSwitch)\n"
" {\n"
" for (int i = nLoopStart + 1; i <= nLoopEnd; i++)\n"
" {\n"
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index d4c27a4d0fd5..67573f5ab9c1 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -1795,11 +1795,11 @@ void ScInterpreter::ScVDB()
if ( MustHaveParamCount( nParamCount, 5, 7 ) )
{
double fCost, fSalvage, fLife, fStart, fEnd, fFactor, fVdb = 0.0;
- bool bType;
+ bool bNoSwitch;
if (nParamCount == 7)
- bType = GetBool();
+ bNoSwitch = GetBool();
else
- bType = false;
+ bNoSwitch = false;
if (nParamCount >= 6)
fFactor = GetDouble();
else
@@ -1820,7 +1820,7 @@ void ScInterpreter::ScVDB()
sal_uLong nLoopEnd = (sal_uLong) fIntEnd;
fVdb = 0.0;
- if (bType)
+ if (bNoSwitch)
{
for (sal_uLong i = nLoopStart + 1; i <= nLoopEnd; i++)
{