Average Error: 0.0 → 0.0
Time: 2.5s
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 r231592 = x;
        double r231593 = 2.0;
        double r231594 = r231592 * r231593;
        double r231595 = r231592 * r231592;
        double r231596 = r231594 + r231595;
        double r231597 = y;
        double r231598 = r231597 * r231597;
        double r231599 = r231596 + r231598;
        return r231599;
}

double f(double x, double y) {
        double r231600 = x;
        double r231601 = 2.0;
        double r231602 = r231601 + r231600;
        double r231603 = y;
        double r231604 = r231603 * r231603;
        double r231605 = fma(r231600, r231602, r231604);
        return r231605;
}

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