jashkenas / jashkenas/coffeescript
Number with a dot before `e` in scientific notation returns two dots in JavaScript
Nobody has claimed this yet.
- Dominant language
- CoffeeScript
- Stars
- 16.6k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
Choose one: is this a bug report or feature request? Bug report
### Input Code
Example code:
```coffee
1.e1
```
And another example:
```coffee
1.e-1
```
### Expected Behavior
```js
1.e1;
```
and
```js
1.e-1;
```
### Current Behavior
```js
1..e1;
```
and
```js
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by compiling the reported CoffeeScript inputs `1.e1` and `1.e-1` and compare the generated JavaScript with the expected output. Trace the compiler's handling of numeric literals around the exponent marker, then add regression coverage showing that both forms produce one dot and preserve the exponent expression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- coffeescript, javascript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100