Average Error: 0.0 → 0.0
Time: 664.0ms
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 r444697 = x;
        double r444698 = 2.0;
        double r444699 = r444697 * r444698;
        double r444700 = r444697 * r444697;
        double r444701 = r444699 + r444700;
        double r444702 = y;
        double r444703 = r444702 * r444702;
        double r444704 = r444701 + r444703;
        return r444704;
}

double f(double x, double y) {
        double r444705 = x;
        double r444706 = 2.0;
        double r444707 = r444706 + r444705;
        double r444708 = y;
        double r444709 = r444708 * r444708;
        double r444710 = fma(r444705, r444707, r444709);
        return r444710;
}

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