-
static INLINE CONST VECTOR_CC vfloat2 dfmul_vf2_vf_vf(vfloat x, vfloat y) {
vfloat s = vmul_vf_vf_vf(x, y); // x * y
return vf2setxy_vf2_vf_vf(s,
vfmapn_vf_vf_vf_vf(x, y, s) // x * y - s
);
// x * y - x * y
// 0 ???
} |
Beta Was this translation helpful? Give feedback.
Answered by
blapie
Oct 8, 2024
Replies: 2 comments 1 reply
-
Hello, There are explanations of how to do basic double-double calculations in many places, but see, for example, page 5 of the following paper. |
Beta Was this translation helpful? Give feedback.
0 replies
-
But this is vf * vf -> vf2, and the result is { x * y, 0 } anyway. What is the significance of this operation? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The result isn't
{x * y, 0}
, you have to take into account that operations are done in finite precision arithmetic.Changing your notations slightly and writing x * y the result of the exact/infinite precision multiplication and
fl(x * y)
the result of the floating point one, thenvf2
contains{ fl(x * y), e }
, which is on one hand the result of the finite precision multiplication, and on the other hand an estimation of the errore = x * y - fl(x * y)
(|e| < x * y * eps).Storing this error prevents cancellation in allowing you to re-inject the error into future operations instead, thus creating "error-free" transformations (not entirely free but at least in the first or second order).