Average Error: 5.4 → 5.4
Time: 12.2s
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 r25090944 = x;
        double r25090945 = 1.0;
        double r25090946 = y;
        double r25090947 = r25090946 * r25090946;
        double r25090948 = r25090945 + r25090947;
        double r25090949 = r25090944 * r25090948;
        return r25090949;
}

double f(double x, double y) {
        double r25090950 = y;
        double r25090951 = 1.0;
        double r25090952 = fma(r25090950, r25090950, r25090951);
        double r25090953 = x;
        double r25090954 = r25090952 * r25090953;
        return r25090954;
}

Error

Bits error versus x

Bits error versus y

Target

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

Derivation

  1. Initial program 5.4

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

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

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

Reproduce

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