Average Error: 5.0 → 5.0
Time: 36.0s
Precision: 64
\[x \cdot \left(1 + y \cdot y\right)\]
\[\mathsf{fma}\left(y, y, 1\right) \cdot x\]
x \cdot \left(1 + y \cdot y\right)
\mathsf{fma}\left(y, y, 1\right) \cdot x
double f(double x, double y) {
        double r14908143 = x;
        double r14908144 = 1.0;
        double r14908145 = y;
        double r14908146 = r14908145 * r14908145;
        double r14908147 = r14908144 + r14908146;
        double r14908148 = r14908143 * r14908147;
        return r14908148;
}

double f(double x, double y) {
        double r14908149 = y;
        double r14908150 = 1.0;
        double r14908151 = fma(r14908149, r14908149, r14908150);
        double r14908152 = x;
        double r14908153 = r14908151 * r14908152;
        return r14908153;
}

Error

Bits error versus x

Bits error versus y

Target

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

Derivation

  1. Initial program 5.0

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

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

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

Reproduce

herbie shell --seed 2019200 +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))))