Bug 69068 - RANK() function incorrectly ranking times
Summary: RANK() function incorrectly ranking times
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.0.5.2 release
Hardware: x86 (IA32) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-07 13:33 UTC by Moleskin Joe
Modified: 2014-06-24 18:12 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Simple example of RANK() giving incorrect results. (9.07 KB, application/vnd.oasis.opendocument.spreadsheet)
2013-09-07 13:33 UTC, Moleskin Joe
Details
Original sample modified. (10.94 KB, application/vnd.oasis.opendocument.spreadsheet)
2013-09-07 17:22 UTC, m_a_riosv
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Moleskin Joe 2013-09-07 13:33:35 UTC
Created attachment 85395 [details]
Simple example of RANK() giving incorrect results.

The RANK() function incorrectly ranks equal times generated by subtraction of one time from another.

For example 17:24, 17:35, 17:24, 17:21 should be ranked 2,4,2,1 not 2,4,3,1.

Suggested reason : although the times appear equal, the underlying numbers are different because of rounding.
Comment 1 m_a_riosv 2013-09-07 17:22:27 UTC
Created attachment 85403 [details]
Original sample modified.

Hi Moleskin, thanks for reporting.

Taking your sample, adding a ROUND() function in column D with decimal places referred to D1, you can see once the decimal places are beyond the computer precision RANK() function does not work but works properly with 16 decimal places or less.

Is needed round to get the formulas works as you want.

More useful information about the problem:
http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
Comment 2 afonit 2014-06-24 18:12:25 UTC
I just opened the file in question and sorted on rank - it sorted properly.

I do not have libreoffice 4.1 as poster had, but I am using 4.2.5.2 on Fedora 20,
so I am going to change the status to Resolved,Worksforme.