Javascript Math imul()

Introduction

The Math.imul() function returns 32-bit multiplication of the two parameters.

var product = Math.imul(a, b);
//a - First number.
//b - Second number.
let a = Math.imul(2, 4);          // 8
console.log(a);/*from  w w  w.  ja va2  s . c  o m*/
a = Math.imul(-1, 8);         // -8
console.log(a);
a = Math.imul(-2, -2);        // 4
console.log(a);
a = Math.imul(0xffffffff, 5); // -5
console.log(a);
a = Math.imul(0xfffffffe, 5); // -10
console.log(a);



PreviousNext

Related