Average Error: 5.3 → 5.3
Time: 9.7s
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 r510009 = x;
        double r510010 = 1.0;
        double r510011 = y;
        double r510012 = r510011 * r510011;
        double r510013 = r510010 + r510012;
        double r510014 = r510009 * r510013;
        return r510014;
}

double f(double x, double y) {
        double r510015 = y;
        double r510016 = 1.0;
        double r510017 = fma(r510015, r510015, r510016);
        double r510018 = x;
        double r510019 = r510017 * r510018;
        return r510019;
}

Error

Bits error versus x

Bits error versus y

Target

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

Derivation

  1. Initial program 5.3

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

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

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

Reproduce

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