Why does JavaScript use floating point base numbers (according to w3schools)?

I read this at W3Schools :

All numbers in JavaScript are stored as 64-bit (8-byte) base 10, floating point numbers.

That sounds pretty weird. Now this is either wrong, or there must be a good reason not to use base 2, like the IEEE standard.

I tried to find a real JavaScript definition, but I could not find it. In the V8 or WebKit documentation, the two versions of JavaScript that I could find on Wikipedia that were most familiar to me, I could find how they saved the JavaScript number type.

So, does JavaScript use base 10? If so, why? The only reason I could come up with is that maybe using base 10 has the advantage when you want to be able to store integers as well as floating point numbers exactly, but I don't know how using base 10 will to have an advantage for this myself.

+5
source share
3 answers

This is not the World Wide Web Consortium (W3C) , which is w3schools, a website that is not an authority on any web standards.

Numbers in Javascript are double precision floating point numbers that comply with IEEE standards.

- 64- . 10 , , , , 10.

+7

JavaScript ECMA-262 (ECMAScript 5.1) 4.3.19:

, 64- IEEE 754.

, 10 ECMA-262.

+5

JavaScript , , IEEE754. 10.

The specificity of JavaScript is that there is only one type of number, which is a double precision float. Which has a side effect that you limit somewhat, unlike other languages, if you want to deal with integers: you cannot store an integer with double precision, only those that correspond to the size of the fraction (52 bits).

+4
source

All Articles