Average Error: 0.0 → 0.0
Time: 7.8s
Precision: 64
\[\left(x + y\right) \cdot \left(x - y\right)\]
\[\mathsf{fma}\left(x, x, -y \cdot y\right)\]
\left(x + y\right) \cdot \left(x - y\right)
\mathsf{fma}\left(x, x, -y \cdot y\right)
double f(double x, double y) {
        double r124660 = x;
        double r124661 = y;
        double r124662 = r124660 + r124661;
        double r124663 = r124660 - r124661;
        double r124664 = r124662 * r124663;
        return r124664;
}

double f(double x, double y) {
        double r124665 = x;
        double r124666 = y;
        double r124667 = r124666 * r124666;
        double r124668 = -r124667;
        double r124669 = fma(r124665, r124665, r124668);
        return r124669;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[\left(x + y\right) \cdot \left(x - y\right)\]
  2. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{{x}^{2} - {y}^{2}}\]
  3. Simplified0.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:f1 from sbv-4.4"
  (* (+ x y) (- x y)))