Repository navigation
serializeEpsil takes a numberFormat option to choose the printed digit grouping - #654
Closed
enumeratio wants to merge 1 commit into
Closed
enumeratio wants to merge 1 commit into
enumeratio wants to merge 1 commit into
Conversation
arnog
added a commit
that referenced
this pull request
Nov 22, 2026
…, PR #654 by enumeratio) options.numberFormat (EpsilNumberFormat: digitGroup, digitGroupSeparator) is merged over the fixed format once per call and used at every number call site. A separator other than "" or "_" throws a RangeError, so the output reads back as the same number. Changed from the PR: EpsilNumberFormat leaves out notation and avoidExponentsInRange. A scientific notation writes the integer 3811 as 3.811e3, which reads back as a float, and the engineering notation of serializeNumber writes 0.000012 as 120.0e-3, which reads back as 0.12. The serializeEpsil doc comment is moved onto the function (it sat above SUPERSCRIPT_OF), and the Epsil implementation guide describes the option. Co-authored-by: enumeratio <314378874+enumeratio@users.noreply.github.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.
serializeEpsilprinted every number through a fixed format, so3811was always3_811.options.numberFormat(EpsilNumberFormat:digitGroup,digitGroupSeparator,notation,avoidExponentsInRange) is now merged over that format once per call and used at every number call site.{ digitGroup: 0 }or{ digitGroupSeparator: '' }prints3811.The default is unchanged. The fields that are Epsil syntax (decimal separator, exponent markers, the spellings of
Infinity,NaNandi) are left out of the type, and a separator other than''or_throws aRangeError, so the output always reads back as the same number.Tests:
test/compute-engine/epsil-number-format.test.tscovers the default, ungrouped integer, negative, decimal, big integer and rational, that the output re-parses to the same expression, and the rejected separator. The existing Epsil serialize, parse and round-trip tests pass unchanged.Closes #653