Number范围

浮点数范围:

as  large  as ±1.7976931348623157 × 10的308次方
as small as ±5 × 10的−324次方

精确整数范围:

The JavaScript number format allows you to exactly represent all integers between
−9007199254740992  and 9007199254740992 (即正负2的53次方)

如果数字太大超出范围,解决方法是:

将数字转化为数组,从各位开始,比如a=123456789,表述为数组[6789,2345,1],然后对这种数据实现加减乘数的运算。

ps:不转成字符串是出于性能考虑

数组索引还有位操作:

正负2的31次方

results matching ""

    No results matching ""