Repository navigation
fix: the EDS typed-k and factors sheets read either decimal separator - #72
Merged
Merged
Conversation
On a German-locale Mac the typed-k sheet read "1.9476" as 19 476 300 000 000: its fields used SwiftUI's bare .number format, whose parse takes a period for grouping in a comma region, and Quantify ran with it. The six fields of the typed-k and zeta / cross-section sheets now parse through DecimalEntryFormat, the rule the shared numeric fields already use: one . or , is the decimal point, well-formed grouping is grouping, anything else is refused. Fixes #71. Done: the sheets read 1.9476 and 1,9476 alike. Next: the typed-k sheet's container identifier (separate issue). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Requested by Paul
Fixes #71.
Break: on a German-locale Mac the typed-k sheet read
1.9476as 19476 (and the full1.9476274264058098as 19.476.300.000.000), because SwiftUI's bare.numberparse takes a period as grouping in a comma region. Quantify then ran with that k, with no warning. The zeta / cross-section sheet has the same six-field pattern.Fix:
EDXSheetNumber.format(digits:)wraps the sheets' format inDecimalEntryFormat, the ruleNumericField/OptionalNumericField/NumberEntryFieldalready use. One.or,is the decimal point; well-formed grouping is grouping; anything else is refused and the field keeps its last value. The shown value is ungrouped. Fields changed: k and σ inEDXTypedKSheet; the factor, beam current, live time and probe area inEDXFactorsSheet. No otherTextField(value:format:)with a bare.numberremains in MacEMUI, and mac4DSTEM and macTEM have none.Numbers people type: yes, this changes what a typed number becomes. Left without auto-merge, for Paul.
1.94761.9476274264058098)1,94761.9.4761.9476/1,9476Test:
ShellSpectroscopyTests/EDXSheetNumberTests, under de_DE and en_US. It pins the old format's misreading as the reproduction, both separators as the decimal point, refusal of ambiguous text, and a round trip of the shown value. 4/4 pass;ShellSpectroscopyTestsandShellControlsTestsare green (swift test --parallel).🤖 Generated with Claude Code