es-shims/es5-shim

float number problem

miroslavboda opened this issue · 6 comments

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.

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?

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

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

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

@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.