Why is Number.MAX_SAFE_INTEGER 9,007,199,254,740,991 and not 9,007,199,254,740,992?

前端 未结 2 861
我寻月下人不归
我寻月下人不归 2020-12-24 05:29

ECMAScript 6\'s Number.MAX_SAFE_INTEGER supposedly represents the maximum numerical value JavaScript can store before issues arise with floating point precision

2条回答
  •  执念已碎
    2020-12-24 05:45

    the only number which is in close proximity of another when compared with its next number shows true

    9007199254740992 == 9007199254740993
    true
    9007199254740993 == 9007199254740994
    false
    9007199254740991 == 9007199254740992
    false
    9007199254740997 == 9007199254740998
    false
    

提交回复
热议问题