Average Error: 0.0 → 0.0
Time: 14.2s
Precision: 64
\[\left(x + y\right) \cdot \left(x - y\right)\]
\[\mathsf{fma}\left(x, x, y \cdot \left(-y\right)\right)\]
\left(x + y\right) \cdot \left(x - y\right)
\mathsf{fma}\left(x, x, y \cdot \left(-y\right)\right)
double f(double x, double y) {
        double r128359 = x;
        double r128360 = y;
        double r128361 = r128359 + r128360;
        double r128362 = r128359 - r128360;
        double r128363 = r128361 * r128362;
        return r128363;
}

double f(double x, double y) {
        double r128364 = x;
        double r128365 = y;
        double r128366 = -r128365;
        double r128367 = r128365 * r128366;
        double r128368 = fma(r128364, r128364, r128367);
        return r128368;
}

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 \left(-y\right)\right)}\]
  4. Final simplification0.0

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

Reproduce

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