Average Error: 0.0 → 0.0
Time: 17.0s
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 r94372 = x;
        double r94373 = r94372 * r94372;
        double r94374 = y;
        double r94375 = r94374 * r94374;
        double r94376 = r94373 - r94375;
        return r94376;
}

double f(double x, double y) {
        double r94377 = x;
        double r94378 = y;
        double r94379 = r94378 * r94378;
        double r94380 = -r94379;
        double r94381 = fma(r94377, r94377, r94380);
        return r94381;
}

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 prod-diff0.0

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

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

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

Reproduce

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