Bug 104981 - PERCENTRANK, PERCENTRANK.EXC, PERCENTRANK.INC functions
Summary: PERCENTRANK, PERCENTRANK.EXC, PERCENTRANK.INC functions
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: All All
: medium normal
Assignee: Winfried Donkers
URL:
Whiteboard: target:5.4.0 target:5.3.0.2 target:5.2.5
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-29 17:22 UTC by raal
Modified: 2017-01-04 14:18 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
percentrank (321.25 KB, application/xml)
2016-12-29 17:25 UTC, raal
Details
percentrank.inc (333.41 KB, application/xml)
2016-12-29 17:25 UTC, raal
Details
percentrank.exc (329.77 KB, application/xml)
2016-12-29 17:26 UTC, raal
Details
combined document used for testing the fixes. (463.54 KB, application/vnd.oasis.opendocument.spreadsheet-flat-xml)
2016-12-31 09:35 UTC, Winfried Donkers
Details

Note You need to log in before you can comment on or make changes to this bug.
Description raal 2016-12-29 17:22:01 UTC
Description:
 see attached testcases for PERCENTRANK, PERCENTRANK.EXC, PERCENTRANK.INC functions. We need to check the constraints and results.

Actual Results:  
.

Expected Results:
.


Reproducible: Always

User Profile Reset: No

Additional Info:


User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:50.0) Gecko/20100101 Firefox/50.0
Comment 1 raal 2016-12-29 17:25:14 UTC
Created attachment 130010 [details]
percentrank
Comment 2 raal 2016-12-29 17:25:53 UTC
Created attachment 130011 [details]
percentrank.inc
Comment 3 raal 2016-12-29 17:26:38 UTC
Created attachment 130012 [details]
percentrank.exc
Comment 4 Winfried Donkers 2016-12-30 12:18:17 UTC
Summarising the deficiencies:

-The constraint that argument significance must be 1 or greater is not applied. This is a simple fix. BTW, Excel doesn't apply this constraint either. The constraint is on ODFF1.2 as well as in the Excel function specifications.

-Excel doesn't round values, whereas Calc does. That's why Calc gives 0.667 as result and Excel 0.666 with significance 3 and value 0.666666666... . Mathematically, rounding is the correct way. This is not a Calc bug, but an Excel bug.

-Calc does not calculate the resultant significant digits correctly when the value is between approx. 0.1 and 0.37. It produces at least 1 significant digit too much. This is a bug in the Calc code, I still looking for the exact cause in order to fix it.

@Raal: Given that All 3 functions use the same code and that PERCENTRANK (ODFF1.2) and PERCENTRANK.INC (Excel) are identical, wouldn't 1 test document for all be more efficient?
Comment 5 Winfried Donkers 2016-12-31 09:35:01 UTC
Created attachment 130052 [details]
combined document used for testing the fixes.
Comment 6 Commit Notification 2017-01-03 21:11:29 UTC
Winfried Donkers committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=facb4e69e4c75839df89969206403d2e97146dbd

tdf#104981 Fix deficiencies with PERCENTRANK functions.

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2017-01-04 11:13:08 UTC
Winfried Donkers committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1aa34bf14e86f3b684c56a9db8ebf1307413df5d&h=libreoffice-5-3

tdf#104981 Fix deficiencies with PERCENTRANK functions.

It will be available in 5.3.0.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2017-01-04 14:18:35 UTC
Winfried Donkers committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f0241948bd5c68c50c380d9c38704da563a80ac4&h=libreoffice-5-2

tdf#104981 Fix deficiencies with PERCENTRANK functions.

It will be available in 5.2.5.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.