CKTIS / JavaScript
Number.POSITIVE_INFINITY: infinito positivo
Number.POSITIVE_INFINITY es el valor Number +∞, igual al Infinity global y mayor que cualquier número finito.
Versión: ECMAScript 1 onward; example target: Node.js 24.22.2
Sintaxis
Number.POSITIVE_INFINITYNumber.POSITIVE_INFINITY contiene el infinito positivo del tipo Number. Es igual al Infinity global; también puede surgir por desbordamiento, como Number.MAX_VALUE * 2, o al dividir un número positivo entre +0. No indica un valor ausente: usa value === Infinity o Number.isFinite(value) según el contrato.
Es mayor que todo número finito, pero las comparaciones con NaN son falsas. La aritmética sigue IEEE 754: Infinity - Infinity y 0 * Infinity producen NaN, 1 / Infinity produce +0 y un signo negativo puede producir -Infinity. No es un centinela seguro si cálculos posteriores pueden convertirlo en NaN.
La propiedad existe desde ECMAScript 1 y no es escribible, enumerable ni configurable. Asignarle otro valor se ignora fuera del modo estricto y lanza TypeError en modo estricto. La constante no es función ni constructor; JSON convierte los infinitos en null al serializar.
Ejemplos
const d = Object.getOwnPropertyDescriptor(Number, "POSITIVE_INFINITY");
console.log(Number.POSITIVE_INFINITY === Infinity, d.writable, d.enumerable, d.configurable);
console.log(Number.MAX_VALUE * 2, 1 / Number.POSITIVE_INFINITY);
console.log(Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY, Number.isFinite(Number.POSITIVE_INFINITY));
console.log(Number.POSITIVE_INFINITY > Number.MAX_VALUE, Number.POSITIVE_INFINITY < Number.NaN);Resultado
true false false false Infinity 0 NaN false true false
El ejemplo comprueba el descriptor, el desbordamiento, la división y las operaciones que dan NaN.