Bug 136848 - formula performs unpredictable behavior
Summary: formula performs unpredictable behavior
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: Calc-Function
  Show dependency treegraph
Reported: 2020-09-17 13:53 UTC by Jurgen Gaeremyn
Modified: 2020-09-19 16:11 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

File containing errenonuous bug (14.39 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-09-17 13:53 UTC, Jurgen Gaeremyn
Screenshot of invalid occurrence (25.24 KB, image/png)
2020-09-17 13:54 UTC, Jurgen Gaeremyn
test format scientific (47.98 KB, image/png)
2020-09-19 15:09 UTC, Oliver Brinzing
test_format.ods (18.80 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-09-19 15:10 UTC, Oliver Brinzing
detailed calculation settings (49.43 KB, image/png)
2020-09-19 15:23 UTC, Oliver Brinzing

Note You need to log in before you can comment on or make changes to this bug.
Description Jurgen Gaeremyn 2020-09-17 13:53:10 UTC
Created attachment 165628 [details]
File containing errenonuous bug

When performing this function a few hundres times, sometimes results will be padded with a bunch (up to over 300) zeros.

This bug also existed in

Formula: =TEXT(DEC2HEX(RANDBETWEEN(1,POWER(16,7))),"0000000")
Comment 1 Jurgen Gaeremyn 2020-09-17 13:54:15 UTC
Created attachment 165629 [details]
Screenshot of invalid occurrence

In case the bug won't show on the tester's computer, here a screenshot of the bug.
Comment 2 Roman Kuznetsov 2020-09-19 07:53:46 UTC
hm. it's possibly a rendering problem. If you try increase a row height, then you'll see right result

anyway I confirm it in

Version: (x64)
Build ID: 8c18cd6823ddf4ef5ba67801a84cee26c9b5a9a6
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Vulkan; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: CL

I'm not sure if it may be a function problem...
Comment 3 Oliver Brinzing 2020-09-19 15:09:38 UTC
Created attachment 165682 [details]
test format scientific

it looks like the Text() formula interprets the dec2hex results as scientific numbers.
Comment 4 Oliver Brinzing 2020-09-19 15:10:08 UTC
Created attachment 165683 [details]
Comment 5 Oliver Brinzing 2020-09-19 15:23:05 UTC
Created attachment 165684 [details]
detailed calculation settings

changing "detailed calculation settings" will influence the result.
Comment 6 Oliver Brinzing 2020-09-19 15:24:12 UTC
bzw: i tend to say it is not a bug, cause ms excel 2016 does it same ...
Comment 7 Oliver Brinzing 2020-09-19 15:45:13 UTC
something like =REPT("0";7-LEN(C3))&C3 should work as a repleacement for Text()
Comment 8 Laurent BP 2020-09-19 16:11:43 UTC
DEC2HEX returns a text not a value. You should remove your TEXT function.
TEXT try to interpret string as a value. So each time the string returned by DEC2HEX is of the following type : [0-9]E[0-9] a scientific value is detected.