3 ms·
I always try to relate these floating point issues back to real situations. Is there really a case where you would use a quadratic equation such as this and wha
by barbegal 9y ago
I always try to relate these floating point issues back to real situations. Is there really a case where you would use a quadratic equation such as this and what kind of precision would you really be interested in? In the first example, the root is wrong by 25% in percentage terms but is wrong by less than 2.5e-9 in absolute terms.
What is important is to tailor your maths to the real problem you are solving (and remember garbage in = garbage out). Very rarely do you actually need 53 bits of precision (as you get in a double), or even need to store intermediate results with 53 bits of precision.
- math_and_stuff 9y agoThis exact issue turns out to be critical in the Hessenberg QR algorithm, which is at the heart of MATLAB's eig.
- barbegal 9y agoYeah I understand why a product like Matlab which needs accuracy across a wide range of end use cases would need to consider things like this.