https://bugs.documentfoundation.org/show_bug.cgi?id=138872

--- Comment #9 from Mike Kaganski <[email protected]> ---
The user-visible problem is: having a number like 0.001; formatting it as a
number with two decimals, would show "0.00", while formatting is as a currency,
would show -$0.00.

But the formatting code is completely different. And this is the correct
behavior.

The format string used for "number with two decimals" is "0.00", which uses a
single section (sub-format) for all cases. In this case, the code is able to do
the magic - find out how many decimals to show from the subformat, round, find
out the sign of the rounded result, and display it.

The format string used for "currency" is like
"[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00". And it uses two sections: one for
positive numbers, and one for negative numbers. Since there are two sub-formats
without explicit conditions, the code has to decide which sub-format to use
*before* processing the number: because nothing prevents a user to use, say, 10
decimals in negative sub-format, but only 2 decimals in positive. So it checks
the sign of the *original* number (not of rounded-to-number-of-decimals); and
after that, no rounding result can affect the choice of the sub-format again -
it will use the "[RED]-[$$-409]#,##0.00" format string for the rounded result
of 0.

The format code like "[>-0.005][$$-409]#,##0.00;[RED]-[$$-409]#,##0.00" could
do the job. But I think that making such a string as a default is not good.

WONTFIX IMO.

https://help.libreoffice.org/latest/en-US/text/shared/01/05020301.html

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to