You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe a more robust parser of the scientific or E notation inputs in BigDecimal is worth the effort? Eg I started writing up this EBNF-ish grammar below:
Scientific -> OptionalSign Number
OptionalSign -> s |
Number -> Digits OptionalFractional OptionalExponent | Fractional OptionalExponent
OptionalFractional -> '.' OptionalDigits
Fractional -> '.' Digits
OptionalExponent -> e OptionalSign Digits |
OptionalDigits -> Digits |
Digits -> Digit RepeatDigit
RepeatDigit -> Digit |
Digit -> n
Here is a proposal that implements a first pass at this (not stack based to avoid needing a stack, just a translation of the parse table into logic):
PR which is still a work in progress and would benefit from your inputs should we wish to progress with this RFC: #9581
I also note overflowing exponent values will raise Invalid UInt64 exceptions (e.g BigDecimal.new("1e18446744073709551616")). Maybe this is an implementation detail which could be more neatly wrapped in a ArgumentError/InvalidBigDecimalException on parsing?
Related to #9547
Maybe a more robust parser of the scientific or E notation inputs in
BigDecimal
is worth the effort? Eg I started writing up this EBNF-ish grammar below:then created the productions below (syntax below works in http://hackingoff.com/compilers/ll-1-parser-generator)
Here is a proposal that implements a first pass at this (not stack based to avoid needing a stack, just a translation of the parse table into logic):
PR which is still a work in progress and would benefit from your inputs should we wish to progress with this RFC: #9581
I also note overflowing exponent values will raise
Invalid UInt64
exceptions (e.gBigDecimal.new("1e18446744073709551616")
). Maybe this is an implementation detail which could be more neatly wrapped in aArgumentError
/InvalidBigDecimalException
on parsing?(originally part of #9547)
The text was updated successfully, but these errors were encountered: