Number.POSITIVE_INFINITY
The Number.POSITIVE_INFINITY property represents the positive Infinity value.
Value
The same as the value of the global Infinity property.
Description
The Number.POSITIVE_INFINITY value behaves slightly differently than mathematical infinity:
- Any positive value, including
Number.POSITIVE_INFINITY, multiplied byNumber.POSITIVE_INFINITYisNumber.POSITIVE_INFINITY. - Any negative value, including
Number.NEGATIVE_INFINITY, multiplied byNumber.POSITIVE_INFINITYisNumber.NEGATIVE_INFINITY. - Any positive number divided by
Number.POSITIVE_INFINITYis positive zero (as defined in IEEE 754). - Any negative number divided by
Number.POSITIVE_INFINITYis negative zero (as defined in IEEE 754. - Zero multiplied by
Number.POSITIVE_INFINITYisNaN. NaNmultiplied byNumber.POSITIVE_INFINITYisNaN.Number.POSITIVE_INFINITY, divided by any negative value exceptNumber.NEGATIVE_INFINITY, isNumber.NEGATIVE_INFINITY.Number.POSITIVE_INFINITY, divided by any positive value exceptNumber.POSITIVE_INFINITY, isNumber.POSITIVE_INFINITY.Number.POSITIVE_INFINITY, divided by eitherNumber.NEGATIVE_INFINITYorNumber.POSITIVE_INFINITY, isNaN.Number.POSITIVE_INFINITY > xis true for any number x that isn'tNumber.POSITIVE_INFINITY.
You might use the Number.POSITIVE_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.POSITIVE_INFINITY is a static property of Number, you always use it as Number.POSITIVE_INFINITY, rather than as a property of a number value.