Does JavaScript have double floating point number precision?

前端 未结 3 1119
一个人的身影
一个人的身影 2020-11-29 08:18

I know it\'s an odd question, but does JavaScript have the capacity to work with double\'s as opposed to single floats? (64 bit floats vs. 32 bits.)

3条回答
  •  一个人的身影
    2020-11-29 08:38

    According to the ECMA-262 specification (ECMAScript is the specification for Javascript), section 8.5:

    The Number type has exactly 18437736874454810627 (that is, 264−253+3) values, representing the double-precision 64-bit format IEEE 754 values as specified in the IEEE Standard for Binary Floating-Point Arithmetic

    Source: http://www.ecma-international.org/publications/files/ecma-st/ECMA-262.pdf (PDF)

提交回复
热议问题