If you multiply 0,000005 by 1000000 the result is 5
Playing with GPS coordinates, at one cell I did 43,271815-43,27181 and it gives 0,000005 exact but if you take that result and multiply it by 1000000 the result is 4,9999999945
Build ID: 350m1(Build:2)
Ubuntu 12.04 x86_64
Operating System: Ubuntu
Version: 3.5 all versions
(In reply to comment #0)
> Problem description:
> If you multiply 0,000005 by 1000000 the result is 5
> Playing with GPS coordinates, at one cell I did 43,271815-43,27181 and it
> gives 0,000005 exact but if you take that result and multiply it by 1000000
> the result is 4,9999999945
> LibreOffice 126.96.36.199
> Build ID: 350m1(Build:2)
> Ubuntu 12.04 x86_64
> Current behavior:
> Expected behavior:
> Operating System: Ubuntu
> Version: 3.5 all versions
Unfortunately such errors are caused by the real number representation (called floating-point) in computers and happen because of limited capacity to store the numbers and because you can not represent some decimal fractions (like 1/10 -> 0.1 for example) exactly in binary. Read more about this in . I think that Calc sometimes works around the issue by using fraction representation (represents numbers in numerator / denominator form) if it is possible but sometimes (like in your case) it can not. Usually in such cases you need to round the number to a certain decimal places you think it makes sense with ROUND operator. For example (=ROUND((43.271815-43.27181) * 1000000, 5)) if you want to round to 5 decimal places.
: http://docs.python.org/2/tutorial/floatingpoint.html chapter Floating Point Arithmetic: Issues and Limitations
I changed my mind and reopened this bug. The reason is that I think this is something very important that should be put into the documentation. Can someone check the documentation if this is included and add if it is not, add it. I will change the component from Calc to Documentation.
Perhaps related to or same as Bug 37923, also contain subtraction
(In reply to comment #3)
> Perhaps related to or same as Bug 37923
Almost certainly a duplicate. Summary edited for clarity.
(In reply to comment #2)
> I changed my mind and reopened this bug. The reason is that I think this is
> something very important that should be put into the documentation. Can
> someone check the documentation if this is included and add if it is not,
> add it. I will change the component from Calc to Documentation.
Agreed. Can someone add the Documentation mailing list to the CC list for greater visibility and to solicit comment? I tried and failed. I had a look through the Calc Guide v4.1 and note:
- "precision" references are mainly to the "Precision as shown" option (pp.222, 361-362) and the EUROCONVERT() function (p.388). I note the entry for "precision" in the index indicates p.354, which seems unrelated. Also, note that the "Precision as shown" option appears dependant on the cell format not being General (it must be a Number) as recently discussed here (in the comment by Mark Bourne):
- " rounding" (leading space to avoid some false positives) references are mainly to the topic of "Rounding off numbers" (pp.221-222) and the "Decimal places" display option when formatting cells (pp.362), as well as the FLOOR() and CEILING() functions.
It would be good if this limitation, in how integer values are handled (generally by all computers) affects precision in calculation, could be added to the beginning of the Calc Guide somewhere (the Preface?). IMO this needs to be clearly highlighted using the "Caution!" block style (shown on p.174) and preferably present a clear example of basic addition and subtraction using large and small values. This would enable the developers, QA, and others to point out a location where this limitation is officially described.
I can't find any information related to this topic (using key terms such as "Calc" + "precision", "rounding", or "limitation") in either the LO Help website or TDF wiki. It should be added to these repositories also.
Marking as a duplicate as two have suggested that - if it's not a dupe please set to NEW not REOPENED. Thanks
*** This bug has been marked as a duplicate of bug 37923 ***
I don't think this is a dupe.
This bug is a request to describe the current behavior and limitations in Calc (Documentation).
Bug 37923 is an enhancement request to improve/increase the current limits in the code (Development).
*** Bug 86005 has been marked as a duplicate of this bug. ***
*** Bug 37923 has been marked as a duplicate of this bug. ***
*** Bug 80017 has been marked as a duplicate of this bug. ***
*** Bug 90997 has been marked as a duplicate of this bug. ***
*** Bug 92536 has been marked as a duplicate of this bug. ***
I'm going back on my high horse so please bear with me, there is a reason.
The fact that a multiplication or a division can lead to errors in rounding is a well known problem and requires the use of such as functions as ROUND().
My problem is that, under certain circumstances, addition and subtraction bring in rounding errors. I understand that numbers are saved in floating point and that Excel has the same problem but if cell A1 is loaded with a number with limited decimals (say 15,02) and cell B1 has a value of 10,02 I should expect to always get A1+B1=25.04 and not 25.03999999999. My main beef is that both numbers are inputed and not calculated (so I KNOW they have ONLY two decimal places) and thus output should be ALWAYS on two decimal places.
There is something that would need to be done to how inputed numbers are memorized, I realize that it will never happen because it would be a major piece of work (and I no longer have the necessary programming skills). But, please, no answers such as the one I received "Excel does it too": if somebody else does something wrong that doesn't justify me repeating the same mistake!
However I would really like to see a more precise piece of documentation which explains exactly under which conditions does an addition or subtraction of numbers inputed with a fixed number of decimals give a result that is not equally exact.
Well - it's going to be guessing and checking. Feel free to join the documentation team and contribute there. Wiki is open access - you can create a page and start documenting where you see problems (going off of the sample files and duplicates on this bug). Pretty easy thing to do so telling others to do it makes no sense if it's so important to you....
** Please read this message in its entirety before responding **
To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.
There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.
If you have time, please do the following:
Test to see if the bug is still present on a currently supported version of LibreOffice
(5.1.5 or 5.2.1 https://www.libreoffice.org/download/
If the bug is present, please leave a comment that includes the version of LibreOffice and
your operating system, and any changes you see in the bug behavior
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave
a short comment that includes your version of LibreOffice and Operating System
Please DO NOT
Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not
appropriate in this case)
If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3)
2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to "inherited from OOo";
4b. If the bug was not present in 3.3 - add "regression" to keyword
Feel free to come ask questions or to say hello in our QA chat: http://webchat.freenode.net/?channels=libreoffice-qa
Thank you for helping us make LibreOffice even better for everyone!
Today my spouse pointed out a simple error in calculation in a spreadsheet. Simple addition and subtraction used for money but cells formatted as numbers and general.
Build ID: 188.8.131.52-3.fc26
CPU Threads: 8; OS Version: Linux 4.12; UI Render: default; VCL: gtk3; Layout Engine: new;
Locale: en-CA (en_CA.UTF-8); Calc: group
What is interesting is I ended up with two different results within a spreadsheet for the same numbers though the difference is a rounding error.
I understand the reason this is happening but I don't understand why in a spreadsheet, I get two different rounding results for the same number.
Created attachment 135971 [details]
Same forumula, different results - part of rounding issues
This is a test spreadsheet to test this bug and rounding for straight addition. One cell is correct with the others showing the rounding issue. Raises an interesting question of how it occurred.