Number.NEGATIVE_INFINITY
The Number.NEGATIVE_INFINITY
property represents the negative Infinity value.
Value
The same as the negative value of the global Infinity
property.
Description
The Number.NEGATIVE_INFINITY
value behaves slightly differently than mathematical infinity:
- Any positive value, including
Number.POSITIVE_INFINITY
, multiplied byNumber.NEGATIVE_INFINITY
isNumber.NEGATIVE_INFINITY
. - Any negative value, including
Number.NEGATIVE_INFINITY
, multiplied byNumber.NEGATIVE_INFINITY
isNumber.POSITIVE_INFINITY
. - Any positive value divided by
Number.NEGATIVE_INFINITY
is negative zero (as defined in IEEE 754). - Any negative value divided by
Number.NEGATIVE_INFINITY
is positive zero (as defined in IEEE 754). - Zero multiplied by
Number.NEGATIVE_INFINITY
isNaN
. NaN
multiplied byNumber.NEGATIVE_INFINITY
isNaN
.Number.NEGATIVE_INFINITY
, divided by any negative value exceptNumber.NEGATIVE_INFINITY
, isNumber.POSITIVE_INFINITY
.Number.NEGATIVE_INFINITY
, divided by any positive value exceptNumber.POSITIVE_INFINITY
, isNumber.NEGATIVE_INFINITY
.Number.NEGATIVE_INFINITY
, divided by eitherNumber.NEGATIVE_INFINITY
orNumber.POSITIVE_INFINITY
, isNaN
.x > Number.NEGATIVE_INFINITY
is true for any number x that isn'tNumber.NEGATIVE_INFINITY
.
You might use the Number.NEGATIVE_INFINITY
property to indicate an error condition that returns a finite number in case of success. Note, however, that NaN
would be more appropriate in such a case.
Because Number.NEGATIVE_INFINITY
is a static property of Number
, you always use it as Number.NEGATIVE_INFINITY
, rather than as a property of a number value.