javascript - Why Number.prototype.toPrecision() returns weird results with precision greater than 16 in Chrome and Firefox and not in IE11 -


i know in javascript maximun , minimun safe numbers of precision 16 (tested in chrome):

number.max_safe_integer → 9007199254740991 number.min_safe_integer → -9007199254740991 

however number.prototype.toprecision() allows numbers greater 16, until 21. in range results wierd (wierd = don't understand right now):

6.789.toprecision(21) → "6.78899999999999970157" /*¿why "70157" ending in chrome(34.0.1847.137) , firefox(29.0.1)?*/ 2.345.toprecision(21) → "2.34500000000000019540" /*¿why "19540" ending in chrome , firefox?*/ 

ie11(11.0.99) returns expected:

6.789.toprecision(21) → "6.78900000000000000000" 2.345.toprecision(21) → "2.34500000000000000000" 
  • ¿is bug in javascript engines of chrome(v8) , firefox(spidermonkey)?
  • ¿is ie11 javascript engine (chakra) better in it's number.prototype.toprecision() interpretation?


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -