Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

javascript
math
imul
communitycreator

What is Math.imul() in JavaScript?

Arslan Bajwa

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Math is a built-in object in JavaScript that contains different methods and properties used to perform mathematical operations. It contains the imul() function, which is used to compute 32-bit integer multiplication of two specified values.

Syntax

Math.imul(param1, param2);

Parameter

  • param1: This is the first input value of Number type for which we want to find the imul().

  • param2: This is the second input value of Number type for which we want to find the imul().

Return value

  • Number: It returns the 32-bit integer multiplication of the two parameters param1 and param2.

If Number is not an integer, it is first converted into an integer.

Example

console.log("imul(2,4) = " + Math.imul(2,4));
console.log("imul(-10,10) = " + Math.imul(-10,-10));
console.log("imul(0,4) = " + Math.imul(0,4));
console.log("imul(3.34,4.2) = " + Math.imul(3.34,4.2));
console.log("imul(-0.15,-4.11) = " + Math.imul(-0.15,-4.11));

RELATED TAGS

javascript
math
imul
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring