Note that there are some explanatory texts on larger screens.

plurals
  1. POCross browser Javascript number precision
    primarykey
    data
    text
    <p>Within JavaScript, numbers are defined as 64bit double-precision. I have a specific use in mind for a distributed web application, which would only work if I can rely on consistent results across all browsers.</p> <p>Despite the spec using the IEEE standard, I naturally have a suspicion that there may be tiny differences in implementations of the maths library or even the underlying hardware, which could cause compound errors.</p> <p>Is there any source of compatibility data, or a reliable test suite to verify double precision calculations in the browser? In particular, I also need to consider mobile browsers (usually ARM based).</p> <p>Clarification -</p> <p>This is a question about browser compatibility. I'm trying to understand whether all browsers can be relied upon to treat numbers in a reliable, consistent and repeatable way as defined for IEEE floating point. In most languages this is a safe assumption, but it's interesting that there's a little uncertainty about this in the browser.</p> <p>There's been some great advice on how to avoid floating point problems due to lack of precision and rounding errors. In most cases, if you require accuracy you should follow this advice!</p> <p>For this question, I'm not trying to avoid the problem but understand it. Floating point numbers are inherently inaccurate by design, but as long as some care is taken with how builds are made that inaccuracy can be completely predictable and consistent. IEEE-754 describes this to a level of detail that only a standards body could.</p> <p>I've decided to offer a small bounty if anyone can cite,</p> <ul> <li>Genuine compatibility data relating to the implementation of IEEE numbers in mainstream browsers. </li> <li>A test suite intended to verify the implementation within the browsers, including verifying the correct internal use of a 64 bit floating point number (53 bit mantissa).</li> </ul> <p>In this question I'm not looking for alternative options, workarounds or ways to avoid the problem. Thank you for the suggestions.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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