Anyway, here is my minifier for JavaScript numeric literals, I hope it is of use to youhttps://github.com/ferno/minify-numeric-literal …
-
-
Replying to @qntm
My module shortens "1.476925632985436e99" by 1 character to "1476925632985436e84", eat that, UglifyJS
1 reply 0 retweets 7 likes -
Replying to @qntm
UglifyJS's approach is a little mystifying. "Maybe the octal representation is shorter!" https://github.com/mishoo/UglifyJS2/blob/569c21e952c99340db73d6ad1c7102500cc1b341/lib/output.js#L1312 …
1 reply 1 retweet 4 likes -
Replying to @qntm
Whether the hex representation is shorter than the decimal changes several times as numbers get bigger http://stackoverflow.com/questions/9458614/at-what-point-do-hexadecimal-representations-of-numbers-take-up-less-chars-than …
1 reply 1 retweet 3 likes -
Replying to @qntm
Additionally, there's an incredibly small number of cases where `0xfff...f` represents the same float as `0x1000...0` but saves a character
1 reply 0 retweets 2 likes -
Replying to @qntm
The same is true in base 10 (i.e. `999...9` represents the same float as `1000...0` but saves a character) but by then you're using `1e21`
1 reply 0 retweets 2 likes -
Replying to @qntm
Handling numbers in general, not just numeric literals, has far more pitfalls and potential for optimisation
1 reply 0 retweets 2 likes -
Replying to @qntm
An earlier version of UglifyJS naively replaced `Infinity` with `1/0`, but that turned e.g. `x/Infinity` into `x/1/0`
1 reply 0 retweets 2 likes -
Replying to @qntm
It also replaced `NaN` with `0/0`, turning `x/NaN` (always `NaN`) into `x/0/0` (`Infinity`, `-Infinity`, `NaN`) and SAVING NO CHARACTERS
2 replies 0 retweets 3 likes -
Replying to @qntm
I seem to remember `NaN` not being a value in older browsers (only output, not input).
1 reply 0 retweets 0 likes
I know of no environment where the `NaN` global is missing, but I suspect that it, like `undefined`, may once have been reassignable
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.