JS: Math fround, clz32, imul

By Xah Lee. Date: .
Math.fround(x)

(new in ECMAScript 2015)

Return the nearest 32bits representation of x.

Math.fround() rounds a JavaScript number (which is always 64-bit double precision) to the nearest 32-bit single-precision floating-point number (the same format used by float in C, Java, etc.).

JavaScript numbers are double precision (64-bit) by default. This gives very high precision, but sometimes you need to match 32-bit float behavior.

Math.clz32(x)

(new in ECMAScript 2015)

Return the number of leading zero bits in the 32-bit binary representation of x.

Math.imul(a, b)

(new in ECMAScript 2015)

multiplies a and b as though they were 32 bit signed integers.

JavaScript. math functions.