Bug 132990 - The sum of these specific numbers all of which have a maximum of two decimal places produces a wrong result that has 14
Summary: The sum of these specific numbers all of which have a maximum of two decimal ...
Status: RESOLVED DUPLICATE of bug 128312
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.4.2 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-13 01:22 UTC by simsalternateemail
Modified: 2020-06-26 15:23 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Spreadsheet with the numbers and formula used (11.25 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-05-13 01:23 UTC, simsalternateemail
Details
Screenshot of Libreoffice and Google Sheets producing different results (31.10 KB, image/png)
2020-05-13 01:26 UTC, simsalternateemail
Details

Note You need to log in before you can comment on or make changes to this bug.
Description simsalternateemail 2020-05-13 01:22:15 UTC
Description:
I pasted in a series of numbers from a CSV. When I added a SUM function to calculate the total, the expected number was 5.31 (Produced in Google Sheets), but LibreOffice produced 5.31000000000005 which in incorrect. This happened regardless of which cells were used. Changing the third value (-699.26) to something with a single decimal place seems to fix the issue, but using two decimal places here seems to cause it.

The numbers are the following:
-10.19
108.47
-699.26
47.99
3.96
32.32
8.68
6.14
6.14
35.7
10.12
7.85
33.89
21.44
3.36
7.76
15.81
25.96
-7.76
51.8
146.89
32.75
23.98
31.63
59.88



Steps to Reproduce:
1.Paste in the sequence of numbers that were provided in the description onto a single column
2.Add a sum function anywhere to calculate the total those numbers
3.

Actual Results:
LibreOffice calculated 5.31000000000005

Expected Results:
Should have calculated 5.31


Reproducible: Always


User Profile Reset: Yes


OpenGL enabled: Yes

Additional Info:
Please note that you have to expand the column for the whole number to be visible. Looks alright when you have it at the default length

Happens both with and without OpenGL Enabled

Version: 6.3.4.2 (x64)
Build ID: 60da17e045e08f1793c57c00ba83cdfce946d0aa
CPU threads: 16; OS: Windows 10.0; UI render: default; VCL: win; 
Locale: en-CA (en_CA); UI-Language: en-US
Calc: CL
Comment 1 simsalternateemail 2020-05-13 01:23:50 UTC
Created attachment 160738 [details]
Spreadsheet with the numbers and formula used
Comment 2 simsalternateemail 2020-05-13 01:26:43 UTC
Created attachment 160739 [details]
Screenshot of Libreoffice and Google Sheets producing different results
Comment 3 Oliver Brinzing 2020-05-14 17:30:02 UTC
this issue looks like a duplicate of

Bug 128312 - Calculation involing some decimals return incorrect floats with 12 d.p.
Comment 4 roy.magne 2020-05-30 04:29:19 UTC
I reproduced the problem in version Versjon 6.4.4.2 (x64)
Build-ID: 3d775be2011f3886db32dfd395a6a6d1ca2630ff

I noticed this when I had a spreadsheet with several digits with only two decimals. When I summed up the numbers the sum had more than two decimals

In a new sheet enter this in a cell:

=4.35-4.28

The sum I get is this:
0.069999999999999

I had expected this:
0.07
Comment 5 Vignesh 2020-06-12 16:43:57 UTC
For some reason, when involving decimals the rounding of the sum and the average is to 12 decimal points
Comment 6 Buovjaga 2020-06-26 15:23:53 UTC
Yep, let's close as duplicate

*** This bug has been marked as a duplicate of bug 128312 ***