Skip to Main content Skip to Navigation
Journal articles

The relative accuracy of $(x+y)*(x-y)$

Claude-Pierre Jeannerod 1, 2, 3
2 ARIC - Arithmetic and Computing
Inria Grenoble - Rhône-Alpes, LIP - Laboratoire de l'Informatique du Parallélisme
Abstract : We consider the relative accuracy of evaluating $(x+y)(x-y)$ in IEEE floating-point arithmetic, when $x,y$ are two floating-point numbers and rounding is to nearest. This expression can be used, for example, as an efficient cancellation-free alternative to $x^2-y^2$ and (at least in the absence of underflow and overflow) is well known to have low relative error, namely, at most about $3u$ with $u$ denoting the unit roundoff. In this paper we propose to complement this traditional analysis with a finer-grained one, aimed at improving and assessing the quality of that bound. Specifically, we show that if the tie-breaking rule is to away then the bound $3u$ is asymptotically optimal (as the precision tends to $\infty$). In contrast, if the tie-breaking rule is to even, we show that asymptotically optimal bounds are now $2.25u$ for base two and $2u$ for larger bases, such as base ten. In each case, asymptotic optimality is obtained by the explicit construction of a certificate, that is, some floating-point input $(x,y)$ parametrized by $u$ and such that the error of the associated result is equivalent to the error bound as $u$ tends to zero. We conclude with comments on how $(x+y)(x-y)$ compares with $x^2$ in the presence of floating-point arithmetic, in particular showing cases where the computed value of $(x+y)(x-y)$ exceeds that of $x^2$.
Complete list of metadata

https://hal.inria.fr/hal-02100500
Contributor : Claude-Pierre Jeannerod <>
Submitted on : Monday, May 17, 2021 - 2:01:29 PM
Last modification on : Tuesday, May 18, 2021 - 3:33:12 AM

File

relative_accuracy_xy_with_appe...
Files produced by the author(s)

Identifiers

Collections

Citation

Claude-Pierre Jeannerod. The relative accuracy of $(x+y)*(x-y)$. Journal of Computational and Applied Mathematics, Elsevier, 2020, pp.1-17. ⟨10.1016/j.cam.2019.112613⟩. ⟨hal-02100500v3⟩

Share

Metrics

Record views

77

Files downloads

99