Average Error: 5.1 → 5.1
Time: 6.7s
Precision: 64
\[x \cdot \left(1.0 + y \cdot y\right)\]
\[\mathsf{fma}\left(y, y, 1.0\right) \cdot x\]
x \cdot \left(1.0 + y \cdot y\right)
\mathsf{fma}\left(y, y, 1.0\right) \cdot x
double f(double x, double y) {
        double r8207459 = x;
        double r8207460 = 1.0;
        double r8207461 = y;
        double r8207462 = r8207461 * r8207461;
        double r8207463 = r8207460 + r8207462;
        double r8207464 = r8207459 * r8207463;
        return r8207464;
}

double f(double x, double y) {
        double r8207465 = y;
        double r8207466 = 1.0;
        double r8207467 = fma(r8207465, r8207465, r8207466);
        double r8207468 = x;
        double r8207469 = r8207467 * r8207468;
        return r8207469;
}

Error

Bits error versus x

Bits error versus y

Target

Original5.1
Target0.1
Herbie5.1
\[x + \left(x \cdot y\right) \cdot y\]

Derivation

  1. Initial program 5.1

    \[x \cdot \left(1.0 + y \cdot y\right)\]
  2. Simplified5.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, y, 1.0\right) \cdot x}\]
  3. Final simplification5.1

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

Reproduce

herbie shell --seed 2019156 +o rules:numerics
(FPCore (x y)
  :name "Numeric.Integration.TanhSinh:everywhere from integration-0.2.1"

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

  (* x (+ 1.0 (* y y))))