Hacker News new | ask | show | jobs
by joosteto 3077 days ago
So what if x > MAXNUMBER/2 ?

Also, how can this be faster than x=0-x; ?

3 comments

This took me a second to realize this is satire too.
It's a joke. And yeah, it gives wrong answers for some numbers.

BTW, JS has unary minus, so you can write:

    x = -x
I think the author chose a more efficient table-driven approach, due to the extra 0 in your 0-x expression.