Average Error: 5.2 → 5.2
Time: 11.0s
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 r24070780 = x;
        double r24070781 = 1.0;
        double r24070782 = y;
        double r24070783 = r24070782 * r24070782;
        double r24070784 = r24070781 + r24070783;
        double r24070785 = r24070780 * r24070784;
        return r24070785;
}

double f(double x, double y) {
        double r24070786 = y;
        double r24070787 = 1.0;
        double r24070788 = fma(r24070786, r24070786, r24070787);
        double r24070789 = x;
        double r24070790 = r24070788 * r24070789;
        return r24070790;
}

Error

Bits error versus x

Bits error versus y

Target

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

Derivation

  1. Initial program 5.2

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

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

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

Reproduce

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