Average Error: 0.0 → 0.0
Time: 858.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 r142103 = x;
        double r142104 = r142103 * r142103;
        double r142105 = y;
        double r142106 = r142105 * r142105;
        double r142107 = r142104 - r142106;
        return r142107;
}

double f(double x, double y) {
        double r142108 = x;
        double r142109 = y;
        double r142110 = r142109 * r142109;
        double r142111 = -r142110;
        double r142112 = fma(r142108, r142108, r142111);
        return r142112;
}

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 2020002 +o rules:numerics
(FPCore (x y)
  :name "Examples.Basics.BasicTests:f2 from sbv-4.4"
  :precision binary64
  (- (* x x) (* y y)))