Bug 130761

Summary: Calc Floating point number
Product: LibreOffice Reporter: Thomas <info>
Component: CalcAssignee: Not Assigned <libreoffice-bugs>
Status: CLOSED WONTFIX    
Severity: normal CC: info, xiscofauli
Priority: medium    
Version: Inherited From OOo   
Hardware: All   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:
Attachments: sample file

Description Thomas 2020-02-18 19:20:16 UTC
in A1 type 8
in A2 type =A1+0.1
copy this formula down to A3:A21, A21 then shows 10. In B21 type =ROUNDDOWN(A21). The result is 9.

Might be same problem as in id=130202, but not sure, because autofill gives other values than iterated formulas.
Comment 1 Xisco Faulí 2020-02-18 20:29:00 UTC
Created attachment 157989 [details]
sample file
Comment 2 Xisco Faulí 2020-02-18 20:30:05 UTC
I can reproduce it in

Version: 7.0.0.0.alpha0+
Build ID: 28d844a589e52abfe62dc66b888e78665221ba28
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: x11; 
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded

and back to

LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4
Comment 3 Xisco Faulí 2020-02-18 20:35:34 UTC
I get the same result in Google Sheets, so I'm wondering if 9 is the correct result.
What would be the expected result for you ?
Comment 4 Eike Rathke 2020-02-18 20:53:14 UTC
As usual. Adding floating point 0.1 repeatedly gives inaccurate results as 0.1 is not precisely representable as IEEE 754 double. Don't do that.

If you're interested in details for why 0.1 + 0.2 ≠ 0.3 see links under
https://erack.de/bookmarks/D.html#010203