Math.imul() function returns the result of the C-like 32-bit multiplication of the two parameters.
The result of the C-like 32-bit multiplication of the given arguments.
Math.imul() allows for 32-bit integer multiplication with C-like semantics. This feature is useful for projects like Emscripten.
imul() is a static method of
Math, you always use it as
Math.imul(), rather than as a method of a
Math object you created (
Math is not a constructor).
imul() could be potentially more performant.
Math.imul(2, 4); // 8 Math.imul(-1, 8); // -8 Math.imul(-2, -2); // 4 Math.imul(0xffffffff, 5); // -5 Math.imul(0xfffffffe, 5); // -10
|ECMAScript Language Specification |
BCD tables only load in the browser