Class: Number

barejs/polyfill.Number()

new Number()

Polyfills for Number.

Source:

Members

(static, readonly) EPSILON :number

The Number.EPSILON property represents the difference between 1 and the smallest floating point number greater than 1.

Type:
  • number
Source:

(static, readonly) MAX_SAFE_INTEGER :number

The Number.MAX_SAFE_INTEGER constant represents the maximum safe integer in JavaScript (253 - 1).

Type:
  • number
Source:

(static, readonly) MIN_SAFE_INTEGER :number

The Number.MIN_SAFE_INTEGER constant represents the minimum safe integer in JavaScript (-(253 - 1)).

Type:
  • number
Source:

Methods

(static) isFinite(_value) → {boolean}

Check if a number is finite. Differs from global isFinite by not coercing types.

Parameters:
Name Type Description
_value

the value to check.

Source:
Returns:

True if _value is a finite number

Type
boolean

(static) isInteger(_value) → {boolean}

The Number.isInteger() method determines whether the passed value is an integer.

Parameters:
Name Type Description
_value

the value to check.

Source:
Returns:

True if _value is an integer.

Type
boolean

(static) isNaN(_value) → {boolean}

Check if _value is the special NaN value. Differs from global isNaN by not coercing types.

Parameters:
Name Type Description
_value

the value to check.

Source:
Returns:

True if _value is the NaN value number

Type
boolean

(static) isSafeInteger(_value) → {boolean}

The Number.isSafeInteger() method determines whether the provided value is a number that is a safe integer. A safe integer is an integer that

  • can be exactly represented as an IEEE-754 double precision number, and
  • whose IEEE-754 representation cannot be the result of rounding any other integer to fit the IEEE-754 representation. For example, 253 - 1 is a safe integer: it can be exactly represented, and no other integer rounds to it under any IEEE-754 rounding mode. In contrast, 253 is not a safe integer: it can be exactly represented in IEEE-754, but the integer 253 + 1 can't be directly represented in IEEE-754 but instead rounds to 253 under round-to-nearest and round-to-zero rounding. The safe integers consist of all integers from -(253 - 1) inclusive to 253 - 1 inclusive.
Parameters:
Name Type Description
_value number

The value to test

Source:
Returns:

True if _value is a Number and a safe integer value.

Type
boolean