Skip to content

issue 21: parse floats in scientific notation#22

Merged
robinheghan merged 1 commit into
gren-lang:mainfrom
gilramir:scientific_notation
May 20, 2026
Merged

issue 21: parse floats in scientific notation#22
robinheghan merged 1 commit into
gren-lang:mainfrom
gilramir:scientific_notation

Conversation

@gilramir
Copy link
Copy Markdown
Contributor

Extends the number parser to accept exponent notation like 1e5, 1.5E-3, and 2e+10, in addition to plain decimal floats.

Also changes the FloatingPoint variant of Number.Outcome to carry { val : Float, text : String } instead of a bare Float, so the original source representation is preserved alongside the parsed value. This is useful for formatting and code generation, where we need to know the author's original represenation.

Extends the number parser to accept exponent notation like `1e5`,
`1.5E-3`, and `2e+10`, in addition to plain decimal floats.

Also changes the `FloatingPoint` variant of `Number.Outcome` to carry
`{ val : Float, text : String }` instead of a bare `Float`, so the
original source representation is preserved alongside the parsed value.
This is useful for formatting and code generation, where we need to
know the author's original represenation.
@robinheghan
Copy link
Copy Markdown
Member

Thank you <3

@robinheghan robinheghan merged commit d9f07ac into gren-lang:main May 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants