Bug 106052 - 'Precision as shown' does not work with several subformats
Summary: 'Precision as shown' does not work with several subformats
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Laurent BP
QA Contact:
URL:
Whiteboard: target:5.4.0 target:5.3.3
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-16 21:39 UTC by Laurent BP
Modified: 2017-04-10 13:54 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Sample case as described in bug report (7.74 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-02-16 21:39 UTC, Laurent BP
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent BP 2017-02-16 21:39:43 UTC
Created attachment 131286 [details]
Sample case as described in bug report

Description: With 'Precision as shown' activated, precision is taken from the first subformat. If format is composed of 2 or 3 subformat, and they don't have the same precision, it leads to incorrect behavior

Steps to reproduce:
1. Activate 'Precision as shown' option: Tools > Options > LibreOffice Calc > Calculate
2. In A1, enter =-1/3
3. In A2, enter =3*A1
A2 displays '-1' as no rounding is operate with General format
4. Change number format of A1 to 0.0;-0.00 (see attached file)

Actual behavior:
A1 displays -0.30
A2 displays -0.9

Expected behavior:
A1 should display -0.33
A2 should display -0.99

Bug is located in RoundValueAsShown
http://opengrok.libreoffice.org/xref/core/sc/source/core/data/documen4.cxx#RoundValueAsShown
where precision is taken from the first subformat
Comment 1 Xisco Faulí 2017-02-17 20:34:28 UTC
Confirmed in

Version: 5.4.0.0.alpha0+
Build ID: 880033edde516fc30225005245253293a6a58ba4
CPU Threads: 4; OS Version: Linux 4.8; UI Render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group
Comment 2 Commit Notification 2017-02-21 12:32:23 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e7f769bc67d3f132b477b3c253f8065243b9b8ac

tdf#106052 Treat SubFormat for "Precision as shown"

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Commit Notification 2017-03-02 17:54:15 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=7496f7d3cae8a932dc43ede8a30a99289366a264

Tests for "Precision as shown" following tdf#105657 tdf#106052

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2017-04-10 13:53:13 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=09478b2211bbc9ec34d8de8452e30cf1254a250c&h=libreoffice-5-3

tdf#106052 Treat SubFormat for "Precision as shown"

It will be available in 5.3.3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2017-04-10 13:54:12 UTC
Laurent Balland-Poirier committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e9d13f703f212b317682c35877571903da18b4af&h=libreoffice-5-3

Tests for "Precision as shown" following tdf#105657 tdf#106052

It will be available in 5.3.3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.