You computed two numbers x
and y
which are of a limited precision floating point type. This means that they are already rounded somehow, meaning loss of precision while computing the result. If you subtract those numbers afterwards, you compute the difference between those two already rounded numbers.
The formula you wrote gives you the maximum error for computing the difference, but this error is with regard to the stored intermediate results x
and y
(again: rounded). No method other than x-y
will give you a "better" result (in terms of the complete computation, not only the difference). To put it in a nutshell: the difference can't be more accurate using any formula other than x-y
.
I'd suggest taking a look at arbitrary precision arithmetic math libraries like GMP or Eigen. Use such libraries for computing your equation system. Don't use double
for the matrix computations. This way you can make sure that the intermediate results x
and y
(or the matrices Ax
and B
) are as precise as you want them to be, for example 512 bits, which should definitely be enough for most cases.