Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number with a dot before e in scientific notation returns two dots in JavaScript #5469

Open
lulunac27a opened this issue Sep 12, 2024 · 1 comment

Comments

@lulunac27a
Copy link

Choose one: is this a bug report or feature request? Bug report

Input Code

Example code:

1.e1

And another example:

1.e-1

Expected Behavior

1.e1;

and

1.e-1;

Current Behavior

1..e1;

and

1..e - 1;

Possible Solution

Remove a dot or add a 0 after the dot if there is no number after the dot and before the e in scientific notation.

Context

Using scientific notation with decimals

Environment

  • CoffeeScript version: 2.7.0
@Inve1951
Copy link
Contributor

Changing

coffeescript/src/lexer.coffee

Lines 1314 to 1315 in 817c39a

^ (?:\d+(?:_\d+)*)? \.? \d+(?:_\d+)* # decimal
(?:e[+-]? \d+(?:_\d+)* )?

to \.? (?:\d+(?:_\d+)+)? on the first line may fix this.
I've tried the 1.e-1 syntax in node and firefox and both accept it. Haven't checked the spec.

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

No branches or pull requests

2 participants