Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

Number.isSafeInteger()

2 tags 1 category

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

The safe integers consist of all integers from -(253 – 1) to 253 – 1, inclusive (±9,007,199,254,740,991). 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.

Syntax example: Number.isSafeInteger(testValue)

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…