Average Error: 0.0 → 0.0
Time: 14.6s
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 r148543 = x;
        double r148544 = y;
        double r148545 = r148543 + r148544;
        double r148546 = r148543 - r148544;
        double r148547 = r148545 * r148546;
        return r148547;
}

double f(double x, double y) {
        double r148548 = x;
        double r148549 = y;
        double r148550 = -r148549;
        double r148551 = r148549 * r148550;
        double r148552 = fma(r148548, r148548, r148551);
        return r148552;
}

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)))