Average Error: 0.0 → 0.0
Time: 17.1s
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 r112823 = x;
        double r112824 = r112823 * r112823;
        double r112825 = y;
        double r112826 = r112825 * r112825;
        double r112827 = r112824 - r112826;
        return r112827;
}

double f(double x, double y) {
        double r112828 = x;
        double r112829 = y;
        double r112830 = r112829 * r112829;
        double r112831 = -r112830;
        double r112832 = fma(r112828, r112828, r112831);
        return r112832;
}

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