Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change number formatting with comma as decimal separator #6655

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

DiegoCardoso
Copy link
Contributor

@DiegoCardoso DiegoCardoso commented Sep 18, 2024

Description

Change the number formatting configuration for locales that use commas as decimal separators. Before, the fraction part of the numbers in such locales would allow only 3 digits. This change allows more digits in the fractional part.

Fixes #5731

Type of change

  • Bugfix
  • Feature

Copy link

sonarcloud bot commented Sep 19, 2024

@DiegoCardoso DiegoCardoso changed the title wip: format numbers in formula fix: change number formatting with comma as decimal separator Sep 24, 2024
@DiegoCardoso DiegoCardoso marked this pull request as ready for review September 24, 2024 08:38
@@ -280,6 +280,7 @@ protected DecimalFormat getDecimalFormat(Locale locale) {
DecimalFormat instance = (DecimalFormat) DecimalFormat
.getInstance(locale);
instance.setGroupingUsed(false);
instance.setMaximumFractionDigits(15);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, this setting should match the number of fraction digits specified in EXCEL_FORMULA_BAR_DECIMAL_FORMAT. However, that format allows for 16 digits, not 15.

private static final String EXCEL_FORMULA_BAR_DECIMAL_FORMAT = "###.################";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spreadsheet: Incorrect number formatting in formula - locale and precision is lost
2 participants