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

float number problem #441

Closed
miroslavboda opened this issue May 25, 2017 · 6 comments
Closed

float number problem #441

miroslavboda opened this issue May 25, 2017 · 6 comments

Comments

@miroslavboda
Copy link

Hello, i have probleme with mimification in file es-shim.js and with minifi version.

Problem is in float number (1000000000000000128).toFixed(0) !== '1000000000000000128'

when change it to (1000000000000000128.0).toFixed(0) !== '1000000000000000128'

it works fine, report some one else this BUG? Thanks.

PS: problem is when webpack compile npm module es5-shim, i tried to turn off minification, but it didnt work anyway. Only solution was change 1000000000000000128 to 1000000000000000128.0

Thanks,

Miro.

@ljharb
Copy link
Member

ljharb commented May 25, 2017

ahhh, i see the minified version replaces the number with 0xde0b6b3a7640080.

I'm not sure how to work around that; it'd probably require configuring uglifyjs. Are you implying that adding the .0 prevents uglify from shortening that number?

@miroslavboda
Copy link
Author

miroslavboda commented May 29, 2017 via email

@ljharb
Copy link
Member

ljharb commented May 30, 2017

I tried it, and adding the .0 didn't seem to impact minification at all.

@ljharb ljharb closed this as completed in 6e4bb57 May 30, 2017
@ljharb
Copy link
Member

ljharb commented May 30, 2017

I'll just hack around it for now; uglify isn't worth tinkering with.

@medikoo
Copy link

medikoo commented May 30, 2017

It doesn't seem that 0xde0b6b3a7640080 representation changes anything, is this a problem in specific engines?

In Chrome all seems fine:

screen shot 2017-05-30 at 07 46 13

@ljharb
Copy link
Member

ljharb commented May 30, 2017

@medikoo the issue is in browsers where the last comparison returns false - since it’s due to a bug in their number literal parsing/representations, it very likely does depend on the exact way the number literal is typed.

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

3 participants