Average Error: 0.0 → 0.0
Time: 10.9s
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 r157944 = x;
        double r157945 = r157944 * r157944;
        double r157946 = y;
        double r157947 = r157946 * r157946;
        double r157948 = r157945 - r157947;
        return r157948;
}

double f(double x, double y) {
        double r157949 = x;
        double r157950 = y;
        double r157951 = r157950 * r157950;
        double r157952 = -r157951;
        double r157953 = fma(r157949, r157949, r157952);
        return r157953;
}

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