+ 21
Why JS use double precision floating point numbers???
Just started with JS....nd it's interesting...so I really don't want to keep any doubt in my mind
3 Answers
+ 20
All numbers in JavaScript are double-precision floating point numbers. For more info, Check these out :
http://www.informit.com/articles/article.aspx?p=1997934&seqNum=2
https://en.m.wikipedia.org/wiki/Double-precision_floating-point_format
http://www.crockford.com/javascript/survey.html
+ 7
"Why". It looks like BigNums weren't ready, "because Microsoft is coming for you", and they had to "write JS in 10 days".
Those floats appear in ECMAScript version 1 (what JS is based on), where Numbers are IEEE-754 floats.
Reference....rant + comments:
"[You would think] any sane language runtime would have integers transparently degrade to BIGNUMs...[[sarcasm] for JavaScript dodging the MAXINT problem]..."
https://www.jwz.org/blog/2010/10/every-day-i-learn-something-new-and-stupid/
The author seems to indicate 32-64bit transition was hard for new graduates (so just throw floats at it)...and commentors write that Mozilla + IBM pushed because Microsoft had just undervalued Netscape...and Microsoft (who had ECMAScript as JScript) was coming after Mozilla...giving just 10 days to write JS and make it look like Java (actually C).
Historical "ES" releases:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Language_Resources
Currently:
SoloLearn seems to use ECMAScript from Android WebView (that's Google Chrom...ium).
I see mostly version 5 (ES5) support here, some ES6 (2015).
"Typed arrays" / dataviews support integers but you have to use them on purpose.
Something I wrote to "look inside" floats...where I use some of the special "int" functions ( like getUint8 ):
https://code.sololearn.com/WYCTOysAGnLv/?ref=app
+ 5
JS was made to process information and return to user or/and the browser, most of this information was to calculate something, so the precision was required. I hope I have helped