Bug 144209 - Result with "Precision as shown" with custom string+General number format becomes 0
Summary: Result with "Precision as shown" with custom string+General number format bec...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.2.0.4 release
Hardware: All All
: high major
Assignee: Eike Rathke
URL:
Whiteboard: target:7.3.0 target:7.2.1
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2021-08-31 10:36 UTC by NISZ LibreOffice Team
Modified: 2021-09-04 04:43 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Calc (9.33 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-08-31 10:36 UTC, NISZ LibreOffice Team
Details
Screenshot of the problem in Calc (50.51 KB, image/png)
2021-08-31 10:37 UTC, NISZ LibreOffice Team
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NISZ LibreOffice Team 2021-08-31 10:36:50 UTC
Created attachment 174660 [details]
Example file from Calc

This is related to bug 143950. We tried to create another minimal reproducer, but found a different regression.
Attached file contains a large randomly typed number divided, and the cell is formatted with >"AA "General< format. This should show the division result as “AA 33263342642.5385” 
but instead it shows “AA 0”.

Steps to reproduce:
    1. Open attached file
    2. Notice the A1 cell contents is “AA 0”.
    3. Press F9 to recalculate

Actual results:
Cell content stays the same.

Expected results:
A1 should show “AA 33263342642.5385”; this happens correctly in 7.1.0.

LibreOffice details:
Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: d350a1364a1c34b96d00f2f716c44882b7b57fe9
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Calc: CL

Not yet in 7.1.0

Additional Information:
Bibisected using bibisect-win64-7.2 to:
URL: https://cgit.freedesktop.org/libreoffice/core/commit/?id=49af7e22e61c2e5d440ad55cd362388983e128ae
author	Eike Rathke <erack@redhat.com>	2021-05-22 20:46:35 +0200
committer	Eike Rathke <erack@redhat.com>	2021-05-23 03:04:56 +0200

Related: tdf#136794 tdf#137063 Unlimit decimals in rtl_math_round()

Adding CC to: Eike Rathke

Note: locally reverting this patch fixes both this issue and bug 143950
Comment 1 NISZ LibreOffice Team 2021-08-31 10:37:09 UTC
Created attachment 174661 [details]
Screenshot of the problem in Calc
Comment 2 Eike Rathke 2021-09-01 11:45:25 UTC
Brilliant.. the document has precision as shown enabled and ScDocument::RoundValueAsShown() for this format calls rtl_math_round() with a precision/decimals of -3000 which of course yields 0 now (and previously was simply ignored).
Comment 3 Commit Notification 2021-09-01 20:54:17 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/71b003a12f8afdff42a25786ad0a12ddd6609d59

Resolves: tdf#144209 Handle General containing formats in RoundValueAsShown()

It will be available in 7.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:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Eike Rathke 2021-09-01 20:56:32 UTC
Pending review
https://gerrit.libreoffice.org/c/core/+/121459 for 7-2
https://gerrit.libreoffice.org/c/core/+/121460 for 7-2-1
Comment 5 Xisco Faulí 2021-09-02 14:46:34 UTC
Verified in

Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: c085fc7cd335e3ea50a6bbaedf2f6e8cffadf559
CPU threads: 4; OS: Linux 5.10; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

@Eike, thanks for fixing this issue!!
Comment 6 Commit Notification 2021-09-02 14:48:30 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/3879accdfbee52b3bbecbe20fd1cf4d391189b70

Resolves: tdf#144209 Handle General containing formats in RoundValueAsShown()

It will be available in 7.2.2.

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:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2021-09-02 19:16:41 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d98aae68810a77df399decbe09ba70f99fdb7344

tdf#144209: sc_subsequent_filters_test2: Add unittest

It will be available in 7.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:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2021-09-03 14:06:32 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-7-2-1":

https://git.libreoffice.org/core/commit/eedfa91e777423cb3cd025c8eafd7e031c98f6b9

Resolves: tdf#144209 Handle General containing formats in RoundValueAsShown()

It will be available in 7.2.1.

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:
https://wiki.documentfoundation.org/Testing_Daily_Builds

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