Average Error: 0.0 → 0.0
Time: 1.1s
Precision: 64
\[\left(x \cdot 2 + x \cdot x\right) + y \cdot y\]
\[\mathsf{fma}\left(x, 2 + x, y \cdot y\right)\]
\left(x \cdot 2 + x \cdot x\right) + y \cdot y
\mathsf{fma}\left(x, 2 + x, y \cdot y\right)
double f(double x, double y) {
        double r448374 = x;
        double r448375 = 2.0;
        double r448376 = r448374 * r448375;
        double r448377 = r448374 * r448374;
        double r448378 = r448376 + r448377;
        double r448379 = y;
        double r448380 = r448379 * r448379;
        double r448381 = r448378 + r448380;
        return r448381;
}

double f(double x, double y) {
        double r448382 = x;
        double r448383 = 2.0;
        double r448384 = r448383 + r448382;
        double r448385 = y;
        double r448386 = r448385 * r448385;
        double r448387 = fma(r448382, r448384, r448386);
        return r448387;
}

Error

Bits error versus x

Bits error versus y

Target

Original0.0
Target0.0
Herbie0.0
\[y \cdot y + \left(2 \cdot x + x \cdot x\right)\]

Derivation

  1. Initial program 0.0

    \[\left(x \cdot 2 + x \cdot x\right) + y \cdot y\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 + x, y \cdot y\right)}\]
  3. Final simplification0.0

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

Reproduce

herbie shell --seed 2020081 +o rules:numerics
(FPCore (x y)
  :name "Numeric.Log:$clog1p from log-domain-0.10.2.1, A"
  :precision binary64

  :herbie-target
  (+ (* y y) (+ (* 2 x) (* x x)))

  (+ (+ (* x 2) (* x x)) (* y y)))