Hacker News new | comments | show | ask | jobs | submit login

It's a pretty minor issue - asm.js is viable without it. For multiplications of small numbers, like 5 times x where x is 32-bit, you don't need Math.imul, normal multiply is fine. The only case where Math.imul is useful is x times y where neither x nor y is known at compile-time, so in theory they could be big enough to cause double-rounding in JS.

But even in that case, emscripten can emit code without Math.imul (there is a compiler flag). The code will work, but is a little slower than Math.imul, that's all. In fact in practice you don't even need the polyfill on MDN (which is precise), you can do imprecise multiplication with double-rounding, that works in 99% of cases in my experience, making Math.imul even less crucial.

But it's nice to have Math.imul, just to say that even in the worst case (odd codebase with tons of integer multiplies that are very often of integers both very very large), performance will be predictable and fast.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact