Average Error: 5.5 → 5.5
Time: 9.3s
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 r555143 = x;
        double r555144 = 1.0;
        double r555145 = y;
        double r555146 = r555145 * r555145;
        double r555147 = r555144 + r555146;
        double r555148 = r555143 * r555147;
        return r555148;
}

double f(double x, double y) {
        double r555149 = y;
        double r555150 = 1.0;
        double r555151 = fma(r555149, r555149, r555150);
        double r555152 = x;
        double r555153 = r555151 * r555152;
        return r555153;
}

Error

Bits error versus x

Bits error versus y

Target

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

Derivation

  1. Initial program 5.5

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

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

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

Reproduce

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

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

  (* x (+ 1 (* y y))))