Average Error: 0.0 → 0.0
Time: 6.8s
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 r163651 = x;
        double r163652 = r163651 * r163651;
        double r163653 = y;
        double r163654 = r163653 * r163653;
        double r163655 = r163652 - r163654;
        return r163655;
}

double f(double x, double y) {
        double r163656 = x;
        double r163657 = y;
        double r163658 = r163657 * r163657;
        double r163659 = -r163658;
        double r163660 = fma(r163656, r163656, r163659);
        return r163660;
}

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