JavaScript Numbers are Always 64-bit Floating Point
Unlike many other programming languages, JavaScript does not define different types of numbers, like integers, short, long, floating-point etc. JavaScript numbers are always stored as double precision floating point numbers, following the international IEEE 754 standard. This format stores numbers in 64 bits, where the number (the fraction) is stored in bits 0 to 51, the exponent in bits 52 to 62, and the sign in bit 63.
Integers (numbers without a period or exponent notation) are accurate up to 15 digits.
4条答案
按热度按时间qvtsj1bj1#
同碰到这个问题,从背景页看插件接收到的响应是{"id": 249655320052916224},但是前端展示出来的是{"id": 249655320052916220},末尾数字被抹成0了
1.9.2版本,macOS,chrome浏览器
cnjp1d6j2#
@L-sing 请参考这里
https://www.w3schools.com/js/js_numbers.asp
JavaScript Numbers are Always 64-bit Floating Point
Unlike many other programming languages, JavaScript does not define different types of numbers, like integers, short, long, floating-point etc.
JavaScript numbers are always stored as double precision floating point numbers, following the international IEEE 754 standard.
This format stores numbers in 64 bits, where the number (the fraction) is stored in bits 0 to 51, the exponent in bits 52 to 62, and the sign in bit 63.
Integers (numbers without a period or exponent notation) are accurate up to 15 digits.
对于15位以上的长整数,需要转换成字符串来做传输。
wnavrhmk3#
那只有协调开发转换了
bwitn5fc4#
我也遇到了同样的问题。json-bigint,就不能用吗?我想自己改个,可惜无从下手,不了解原理。