Average Error: 0.0 → 0.0
Time: 842.0ms
Precision: 64
\[x \cdot x - y \cdot y\]
\[\mathsf{fma}\left(x, x, -y \cdot y\right)\]
x \cdot x - y \cdot y
\mathsf{fma}\left(x, x, -y \cdot y\right)
double f(double x, double y) {
        double r140514 = x;
        double r140515 = r140514 * r140514;
        double r140516 = y;
        double r140517 = r140516 * r140516;
        double r140518 = r140515 - r140517;
        return r140518;
}

double f(double x, double y) {
        double r140519 = x;
        double r140520 = y;
        double r140521 = r140520 * r140520;
        double r140522 = -r140521;
        double r140523 = fma(r140519, r140519, r140522);
        return r140523;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[x \cdot x - y \cdot y\]
  2. Using strategy rm
  3. Applied fma-neg0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, -y \cdot y\right)}\]
  4. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(x, x, -y \cdot y\right)\]

Reproduce

herbie shell --seed 2020001 +o rules:numerics
(FPCore (x y)
  :name "Examples.Basics.BasicTests:f2 from sbv-4.4"
  :precision binary64
  (- (* x x) (* y y)))