jashkenas / jashkenas/coffeescript

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

Open
#5,469 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.