From 22be500b1624753decec43c0de4ccb1c5f7a21d4 Mon Sep 17 00:00:00 2001 From: Winfried Donkers Date: Sun, 9 Dec 2018 11:52:18 +0100 Subject: tdf#69569 implement proposed change to ODF1.2 part 2 ยง4.11.7.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Calculating the number of days in a year in AddIn function GetDaysInYear() for basis 1 (actual/actual) gave wrong results. Now the results are correct and the same as in Excel. Extended the unit test document for function YEARFRAC and corrected the unit test document for function AMORDEGRC (verified the results with Excel). Change-Id: Ic68f108496f41dec71b3616095dff80512a64c31 Reviewed-on: https://gerrit.libreoffice.org/64837 Tested-by: Jenkins Reviewed-by: Eike Rathke --- .../data/functions/date_time/fods/yearfrac.fods | 234 ++++++++++++++++++++- .../data/functions/financial/fods/amordegrc.fods | 38 ++-- 2 files changed, 254 insertions(+), 18 deletions(-) (limited to 'sc') diff --git a/sc/qa/unit/data/functions/date_time/fods/yearfrac.fods b/sc/qa/unit/data/functions/date_time/fods/yearfrac.fods index 4d6e896a0388..adbfe0fac983 100644 --- a/sc/qa/unit/data/functions/date_time/fods/yearfrac.fods +++ b/sc/qa/unit/data/functions/date_time/fods/yearfrac.fods @@ -1227,7 +1227,237 @@ without 3rd argument - + + + 28-02-2003 + + + 29-02-2004 + + + =(B34-A34)/YEARFRAC(A34;B34;1) + + + 365,500000 + + + 365,500000 + + + 1 + + + tdf69569, days in year + + + + + 28-02-2003 + + + 28-02-2004 + + + =(B35-A35)/YEARFRAC(A35;B35;1) + + + 365,000000 + + + 365,000000 + + + 1 + + + tdf69569, days in year + + + + + 28-02-2004 + + + 28-02-2005 + + + =(B36-A36)/YEARFRAC(A36;B36;1) + + + 366,000000 + + + 366,000000 + + + 1 + + + tdf69569, days in year + + + + + 01-01-2016 + + + 31-01-2016 + + + =(B37-A37)/YEARFRAC(A37;B37;1) + + + 366,000000 + + + 366,000000 + + + 1 + + + tdf69569, days in year + + + + + 01-01-2016 + + + 01-01-2017 + + + =(B38-A38)/YEARFRAC(A38;B38;1) + + + 366,000000 + + + 366,000000 + + + 1 + + + tdf69569, days in year + + + + + 31-01-2016 + + + 01-01-2017 + + + =(B39-A39)/YEARFRAC(A39;B39;1) + + + 366,000000 + + + 366,000000 + + + 1 + + + tdf69569, days in year + + + + + 31-01-2016 + + + 31-01-2017 + + + =(B40-A40)/YEARFRAC(A40;B40;1) + + + 366,000000 + + + 366,000000 + + + 1 + + + tdf69569, days in year + + + + + 29-02-2016 + + + 01-05-2016 + + + =(B41-A41)/YEARFRAC(A41;B41;1) + + + 366,000000 + + + 366,000000 + + + 1 + + + tdf69569, days in year + + + + + 30-04-2016 + + + 01-09-2016 + + + =(B42-A42)/YEARFRAC(A42;B42;1) + + + 366,000000 + + + 366,000000 + + + 1 + + + tdf69569, days in year + + + + + 30-11-2016 + + + 29-09-2017 + + + =(B43-A43)/YEARFRAC(A43;B43;1) + + + 365.000000 + + + 365,000000 + + + 1 + + + tdf69569, days in year + + + @@ -1246,4 +1476,4 @@ - \ No newline at end of file + diff --git a/sc/qa/unit/data/functions/financial/fods/amordegrc.fods b/sc/qa/unit/data/functions/financial/fods/amordegrc.fods index 6ab807231e40..0e98f330bf0c 100644 --- a/sc/qa/unit/data/functions/financial/fods/amordegrc.fods +++ b/sc/qa/unit/data/functions/financial/fods/amordegrc.fods @@ -1312,11 +1312,11 @@ - - 2808 + + 2813 - - 2808 + + 2813 PRAVDA @@ -1324,7 +1324,9 @@ =AMORDEGRC(J1;J2;J3;J4;J5;J6;J7) - + + tdf69569, verified with Excel2016 + purchase date @@ -1342,11 +1344,11 @@ - - 2808 + + 2813 - - 2808 + + 2813 PRAVDA @@ -1354,7 +1356,9 @@ =AMORDEGRC(10000;DATE(2012;3;1);DATE(2012;12;31);1500;1;0,3;1) - + + tdf69569, verified with Excel2016 + first period @@ -1372,11 +1376,11 @@ - - 2808 + + 2813 - - 2808 + + 2813 PRAVDA @@ -1384,7 +1388,9 @@ =AMORDEGRC(10000;DATE(2012;3;1);DATE(2012;12;31);1500;1;0,3;1) - + + tdf69569, verified with Excel2016 + salvage @@ -1812,4 +1818,4 @@ - \ No newline at end of file + -- cgit