Bug 118177 - Truncating 8*27/27 equals 7 on FILEOPEN if a cell is formatted other than General
Summary: Truncating 8*27/27 equals 7 on FILEOPEN if a cell is formatted other than Gen...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.0 all versions
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Cell-Formula
  Show dependency treegraph
 
Reported: 2018-06-15 09:16 UTC by alex_werne
Modified: 2023-05-12 04:16 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Fraction rounding or truncation bug (9.14 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-06-15 09:17 UTC, alex_werne
Details
truncation corrected (10.87 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-06-15 13:50 UTC, Xavier Van Wijmeersch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description alex_werne 2018-06-15 09:16:28 UTC
Description:
Cell 3C equals seven when it should equal eight. "Refreshing" cell 3F by e.g. changing it to 1*8/27 fixes 3C during the session. The problem reappears on subsequent file opens.

The problem does not seem to appear if the fraction formatting on cell 3F is removed.

Steps to Reproduce:
1. Open file

Actual Results:
Cell 29C equals 22.

Expected Results:
It should equal 23.


Reproducible: Always


User Profile Reset: Yes


OpenGL enabled: Yes

Additional Info:
Version: 6.0.3.2
Build ID: 1:6.0.3-0ubuntu1
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: en-GB (en_GB.UTF-8); Calc: group
Comment 1 alex_werne 2018-06-15 09:17:23 UTC
Created attachment 142764 [details]
Fraction rounding or truncation bug
Comment 2 alex_werne 2018-06-15 09:19:46 UTC
Actual Results should say: "Cell 3C equals 7." Expected Results should say: "It should equal 8."
Comment 3 Eike Rathke 2018-06-15 11:54:51 UTC
This is independent of the fraction format, it happens with any numeric format other than General (due to when loading in some circumstances formulas formatted as General have to be recalculated). The actual cause is that =8/27 isn't exactly representable as decimal number and is stored as 0.296296296296296 which when loading the file is assigned as the formula cell's result until recalculated (which in this case it isn't if not forced, pressing F9 on cell F3 also does it). The same behaviour can be seen if the value 0.296296296296296 is pasted to cell F3, then also with a recalculation the result in cell C3 is 7.

I have no quick idea how this effect could be circumvented other than recalculating everything.
Comment 4 Xavier Van Wijmeersch 2018-06-15 13:50:59 UTC
Created attachment 142770 [details]
truncation corrected

Did changed your formula removed one () and when saving and reopen the file, i have the correct value of 8, see attachment
Formula TRUNC(($A:$A-10*$F$3); when saving and reopen the file give 7 and need Ctrl+Shift+F9 to have 8

Version: 6.2.0.0.alpha0+
Build ID: 90e4c55d01637178418c33ffe818263114a53374
CPU threads: 8; OS: Linux 4.14; UI render: default; VCL: kde4; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2018-06-12_00:10:12
Locale: nl-BE (en_US.UTF-8); Calc: group threaded
Comment 5 Eike Rathke 2018-06-15 17:10:42 UTC
Well, yes, =TRUNC(A3-1)*F3 does something different than =TRUNC((A3-1)*F3) if the value in F3 is is not exactly a fraction of (A3-1). As A3 is an integer that's the same as =(A3-1)*F3

If you loaded your document and widen column C to display all decimals (with cell cursor on C3 press Shift+Alt+CursorRight) you'll see the actual result 7.99999999999999 that for a narrower column is rounded to 8. Same if a number format 0.00000000000000 was applied.
Comment 6 Xavier Van Wijmeersch 2018-06-15 19:03:59 UTC
@Eike

thx for the clarification

on C3 pressing F2 and then F9 shows also 7.99999999
Comment 7 QA Administrators 2019-06-16 02:57:08 UTC Comment hidden (obsolete)
Comment 8 QA Administrators 2021-06-16 03:55:49 UTC
Dear alex_werne,

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 with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

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) from https://downloadarchive.documentfoundation.org/libreoffice/old/

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: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug