Set locale "C" before formatting strings in MATC#781
Open
mmuetzel wants to merge 1 commit intoElmerCSC:develfrom
Open
Set locale "C" before formatting strings in MATC#781mmuetzel wants to merge 1 commit intoElmerCSC:develfrom
mmuetzel wants to merge 1 commit intoElmerCSC:develfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When trying to run the test suite on a Windows system with a locale that uses "," as the decimal separator, multiple tests are failing with errors like the following:
Note the comma (instead of a point) in the string that is returned from MATC.
I tried to explicitly set the locale to "C" in
mtc_init. But that didn't help.To debug that, I used the following change:
That showed that the decimal separator is "." for the first few times that the function is called. But eventually, it changes to "," for some reason. E.g., for the test
AdvDiffFCT, I'm seeing the following in the stdout.log:At some point (I don't know why) the locale seems to be changing to the system default.
If I re-run the test, the locale seems to be changing at a different point in the execution:
The change here "fixes" that by setting the locale to "C" every time that
mtc_domathis called.While that "fixes" the issue at hand for me, I don't really like doing that because changing the locale is computationally costly.
Do you have any idea which part of the execution could potentially affect the locale? If we knew where that is happening, we could potentially make the penalty for changing the locale more localized.