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

TFormula: support locale settings for which the decimal separator is "," #17327

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dpiparo
Copy link
Member

@dpiparo dpiparo commented Dec 20, 2024

Fixes #17225

Copy link
Member

@lmoneta lmoneta left a comment

Choose a reason for hiding this comment

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

LGTM, if it passes the tests should be fine.
Thank you Danilo for the fix

TString value = TString::Format("%lf", (*constIt).second);
// #17225: we take into account LC_LOCALE settings for which the decimal separator
// is , instead of ., e.g. de_AT.UTF-8
TString value = TString::Format("%lf", (*constIt).second).ReplaceAll(",", ".");
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be dependent on the value of LC_LOCALE? (in some local we might have 1,200.00 for one thousand two hundreds).

Copy link
Member Author

Choose a reason for hiding this comment

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

it's a good observation. But how can we adapt to all possible locale?

Copy link
Member Author

Choose a reason for hiding this comment

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

actually it seems that there are only 3 decimal separators: comma, period and arabic decimal separator (https://randombits.dev/articles/number-localization/locale-list)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thinking more about it... If we have an arabic decimal separator, it means that we also have arabic digits. At that point, I am unsure whether the decimal separator would be the first problem we hit...

Copy link
Member

Choose a reason for hiding this comment

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

Actually, I think we need a larger conversation about local and how to handle them. It seems odds/confusion to all support local for this single functions. Until we have this conversation, I recommend we issue an explicit error when encountering a comma here.

Copy link

github-actions bot commented Dec 20, 2024

Test Results

    18 files      18 suites   4d 4h 24m 48s ⏱️
 2 681 tests  2 680 ✅ 0 💤 1 ❌
46 536 runs  46 535 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit c7a2716.

♻️ This comment has been updated with latest results.

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

Successfully merging this pull request may close these issues.

TFormula: Possibility of failure during dynamic compilation of predefined functions "gausn" and "landau"
3 participants