Bug 130761 - Calc Floating point number
Summary: Calc Floating point number
Status: CLOSED WONTFIX
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-18 19:20 UTC by Thomas
Modified: 2020-02-18 20:53 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
sample file (9.42 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-02-18 20:29 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
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