Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>General rule of thumb is that when number precision is important and you only have access to floating point precision numbers, all of your calculations should be done as integer math to best ensure validity (where you're assured 15 digits of assuredly valid data). And yes there are a bunch of general numeric idiosyncrasies in JavaScript but they are more associated with the lack of precision within floating point numbers and not with UA implementations of the standard. Look around for the pitfalls of floating point math, they're numerous and treacherous.</p> <p>I feel as I should elaborate a little, for instance I wrote a program (in JavaScript) that used basic calculus to determine the area of polygon with dimensions given in meters or feet. Instead of doing the calculations as is, the program converted everything to micrometers and did its calculations there as everything would be more integral.</p> <p>hope this helps -ck</p> <hr> <p><em><strong>In response to your clarification, comments and concerns</em></strong></p> <p>I'm not going to repeat my comments below in their entirety, however the short answer is no one will ever be able to say that <a href="https://en.wikipedia.org/wiki/List_of_web_browsers" rel="nofollow"><strong>EVERY IMPLEMENTATION</strong></a> is 100% on 100% of devices. Period. I can say and others will tell you the same, is that on the <strong><em>current major browsers</em></strong> I have not seen nor heard of any browser specific detrimental bug involving floating point numbers. But your question itself is kind of a double edged sword since <strong>you want to "rely" upon "unreliable" results</strong>, or simply that you want all the browsers to be <strong>"consistently inconsistent"</strong> - in other words instead of trying make sure a lion will play fetch, your time would be better spent looking for a dog, meaning: <strong>you can rely 110% on integer math <em>AND the results of said math</em>, the same goes for string math which has already been suggested to you...</strong></p> <p>good luck -ck</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload