The ROUNDDOWN function is imprecise in some cases involving decimal numbers. For example:
ROUNDDOWN(8,94;2) yields 8,94 (correct).
ROUNDDOWN(8,94-8;2) yields 0,93 (wrong).
ROUNDDOWN(7,94-7;2) yields 0,94 (correct).
Steps to Reproduce:
1.Let cell A1 =8.94-8
2.Note how the correct result is displayed (0.94).
3.Let cell B1 =ROUNDDOWN(A1;2)
4. Note the wrong result (0,93).
Wrong result (0.93)
Correct result (0.94)
User Profile Reset: No
OpenGL enabled: Yes
(In reply to Epo Nym from comment #0)
> The ROUNDDOWN function is imprecise in some cases involving decimal numbers.
i can reproduce this already with AOO 4.1.5.
and result is different from MS Excel 2016: 0,94
adding two attachments...
Created attachment 150231 [details]
demo roundown ods
Created attachment 150232 [details]
I understand the cause and in a way it is unavoidable.
It is in most cases not possible with fractional numbers for the internal (binary) value to be exactly the same value as the (decimal) number.
That means that the binary representation of 0.94 could be something like 0.939999999999999 (figures are an example, not actual values). Rounding down the latter will always produce 0.93.
A similar problem will be visible with ROUNDUP for some values.
I will see if I can find a way to avoid or at least significantly reduce the above phenomenon. As I don't know yet if that will be possible, I am not assigning the bug report to myself yet.
Winfried Donkers committed a patch related to this issue.
It has been pushed to "master":
tdf#124286 fix annoying rounding error.
It will be available in 6.3.0.
The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
Affected users are encouraged to test the fix and report feedback.
The patch fixes the issue for ROUNDDOWN as well as ROUNDUP (e.g. ROUNDUP(8.06-8;2).