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

Why are numbers converted to scientific notation? #753

Closed
jordwalke opened this issue Mar 6, 2019 · 2 comments
Closed

Why are numbers converted to scientific notation? #753

jordwalke opened this issue Mar 6, 2019 · 2 comments
Labels

Comments

@jordwalke
Copy link

Why is the number 1000 compiled into 1e3?

I think I have to remove this assumption because in some languages, scientific notation produces a non integer type which are not ===. For example in PHP 1e3 !== 1000 but 1e3 == 1000.

I'm curious what the motivation was behind compiling 1000 into 1e3. I think this could be moved into a minifier stage if the goal was to save some bytes.

@hhugo
Copy link
Member

hhugo commented Mar 6, 2019

The goal was indeed to save some bytes.
For rehp, you most likely have your own version of string_of_number where you can implement whatever is needed without interfering with javascript, right ?

@hhugo hhugo added the question label Mar 10, 2019
@jordwalke
Copy link
Author

Correct, we do - and I've since customized it accordingly. Thanks I was just curious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants