Additionally, there's an incredibly small number of cases where `0xfff...f` represents the same float as `0x1000...0` but saves a character
-
-
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
`1<<17` is shorter than `131072`. `~99` is shorter than `-100`. `1e9-7` is shorter than `999999993`. But when is such a substitution safe?
3 replies 0 retweets 2 likes -
Replying to @qntm
And it turns out the number crunching to determine the shortest possible expression of an arbitrary float is deep and complicated
1 reply 0 retweets 1 like -
Replying to @qntm
`.1+.2` is shorter than `0.30000000000000004` but, starting from the latter, how in the WORLD would you get the former?
2 replies 0 retweets 3 likes -
Replying to @qntm
This seems to be a pretty challenging problem even if you assume no usage or declaration of functions in the available space
1 reply 0 retweets 1 like -
Replying to @qntm
Finding the shortest expression which evaluates to a given float is basically a problem of Kolmogorov complexity (I could be wrong)
2 replies 0 retweets 2 likes
In the worst case, we systematically test every expression with fewer characters than the decimal representation (24 characters at worst)
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.