Average Error: 0.0 → 0.0
Time: 5.1s
Precision: 64
\[\left(x \cdot 2 + x \cdot x\right) + y \cdot y\]
\[\mathsf{fma}\left(y, y, x \cdot \left(2 + x\right)\right)\]
\left(x \cdot 2 + x \cdot x\right) + y \cdot y
\mathsf{fma}\left(y, y, x \cdot \left(2 + x\right)\right)
double f(double x, double y) {
        double r435421 = x;
        double r435422 = 2.0;
        double r435423 = r435421 * r435422;
        double r435424 = r435421 * r435421;
        double r435425 = r435423 + r435424;
        double r435426 = y;
        double r435427 = r435426 * r435426;
        double r435428 = r435425 + r435427;
        return r435428;
}

double f(double x, double y) {
        double r435429 = y;
        double r435430 = x;
        double r435431 = 2.0;
        double r435432 = r435431 + r435430;
        double r435433 = r435430 * r435432;
        double r435434 = fma(r435429, r435429, r435433);
        return r435434;
}

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(y, y, \left(2 + x\right) \cdot x\right)}\]
  3. Final simplification0.0

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

Reproduce

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

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

  (+ (+ (* x 2.0) (* x x)) (* y y)))