-
-
OK so I think what's happening is that when V8 interprets an exponentiation expression dynamically (e.g. `x ** x`) it drops through to `Math.pow`, but when it sees a constant exponentiation expression (e.g. `99 ** 99`) it computes the result inline using a different routine?pic.twitter.com/akoTkZi4Ag
Show this thread -
The inline routine has the advantage of returning the correct answer, whereas `Math.pow` evidently has some kind of bug
Show this thread -
Furthermore, the inline routine seems to be in use for integers only, so it's not possible to simply retire `Math.pow`'s current (faulty) implementation and use the inline exponentiation dealie insteadpic.twitter.com/HCQuj6Ex5B
Show this thread -
I imagine the separate integer exponentiation routine was hand-written for performance gains over calling `Math.pow` in certain scenarios
Show this thread -
Try this, kids at home! (V8 only AFAIK so Chrome or Node.js)pic.twitter.com/cFB2pWFRlA
Show this thread -
-
For future reference I'm seeing this in 64-bit Chrome 72.0.3626.96 on Windows, and in Node.js 10.15.1 which uses V8 6.8.275.32-node.12
Show this thread -
Reportedly a long-known issue with a fix on its way down the pipelinehttps://twitter.com/mathias/status/1094209241311838210 …
Show this thread -
New conversation -
-
-
Makes sense... I'm sure there would be various catastrophic results if they ever changed the behaviour of the old method.
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.