Class: Math

barejs/polyfill.Math()

new Math()

Polyfills for Math.

Source:

Methods

(static) acosh(_x) → {number}

The Math.acosh() function returns the hyperbolic arc-cosine of a number.

Parameters:
Name Type Description
_x number

The value to calculate the arc-cosine of.

Source:
Returns:

The hyperbolic arc-cosine.

Type
number

(static) asinh(_x) → {number}

The Math.asinh() function returns the hyperbolic arcsine of a number.

Parameters:
Name Type Description
_x number

The value to calculate the arcsine of.

Source:
Returns:

The hyperbolic arcsine.

Type
number

(static) atanh(_x) → {number}

The Math.atanh() function returns the hyperbolic arctangent of a number.

Parameters:
Name Type Description
_x number

The value to calculate the arctangent of.

Source:
Returns:

The hyperbolic arctangent.

Type
number

(static) cbrt(_x) → {number}

The Math.cbrt() function returns the cube root of a number.

Parameters:
Name Type Description
_x number

The number to get the cube root of.

Source:
Returns:

The cube root of the number

Type
number

(static) clz32(_x) → {number}

The Math.clz32() function returns the number of leading zero bits in the 32-bit binary representation of a number. "clz32" is short for CountLeadingZeroes32.

Parameters:
Name Type Description
_x number
Source:
Returns:
Type
number

(static) cosh(_x) → {number}

The Math.cosh() function returns the hyperbolic cosine of a number.

Parameters:
Name Type Description
_x number

The value to calculate the cosine of.

Source:
Returns:

The hyperbolic cosine.

Type
number

(static) expm1(_x) → {number}

The Math.expm1() function returns e^x - 1, where x is the argument, and e the base of the natural logarithms.

Parameters:
Name Type Description
_x number

The number.

Source:
Returns:

A number representing e^x - 1, where e is Euler's number and x is the argument.

Type
number

(static) hypot() → {number}

The Math.hypot() function returns the square root of the sum of squares of its arguments.

Source:
Returns:

The square root of the sum of squares of its arguments.

Type
number

(static) imul(_a, _b) → {number}

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

Parameters:
Name Type Description
_a number

Operand A.

_b number

Operand B.

Source:
Returns:

The result of the multiplication.

Type
number

(static) log1p(_x) → {number}

The Math.log1p() function returns the natural logarithm (base e) of 1 + a number.

Parameters:
Name Type Description
_x number

The value to get the logarithm of.

Source:
Returns:

The logarithm of 1 + _x.

Type
number

(static) log2(_x) → {number}

The Math.log2() function returns the base 2 logarithm of a number.

Parameters:
Name Type Description
_x number

The value to get the base 2 logarithm of.

Source:
Returns:

The base 2 logarithm of _x.

Type
number

(static) log10(_x) → {number}

The Math.log10() function returns the base 10 logarithm of a number. Note that this polyfill is subject to rounding errors.

Parameters:
Name Type Description
_x number

The value to get the base 10 logarithm of.

Source:
Returns:

The base 10 logarithm of _x.

Type
number

(static) sign(_x) → {number}

The Math.sign() function returns the sign of a number, indicating whether the number is positive, negative or zero.

Parameters:
Name Type Description
_x number

The number to check

Source:
Returns:

This function has 5 kinds of return values, 1, -1, 0, -0, NaN, which represent "positive number", "negative number", "positive zero", "negative zero" and NaN respectively.

Type
number

(static) sinh(_x) → {number}

The Math.sinh() function returns the hyperbolic sine of a number.

Parameters:
Name Type Description
_x number

The value to calculate the sine of.

Source:
Returns:

The hyperbolic sine.

Type
number

(static) tanh(_x) → {number}

The Math.tanh() function returns the hyperbolic tangent of a number.

Parameters:
Name Type Description
_x number

The value to calculate the tangent of.

Source:
Returns:

The hyperbolic tangent.

Type
number

(static) trunc(_x) → {number}

Unlike other three Math methods: Math.floor(), Math.ceil() and Math.round(), the way Math.trunc() works is very simple and straightforward, just truncate the dot and the digits behind it, no matter whether the argument is a positive number or a negative number.

Parameters:
Name Type Description
_x number

The number to truncate.

Source:
Returns:

The truncated number

Type
number