Average Error: 5.3 → 5.3
Time: 12.6s
Precision: 64
\[x \cdot \left(1 + y \cdot y\right)\]
\[\sqrt{\mathsf{fma}\left(y, y, 1\right)} \cdot \left(\sqrt{\mathsf{fma}\left(y, y, 1\right)} \cdot x\right)\]
x \cdot \left(1 + y \cdot y\right)
\sqrt{\mathsf{fma}\left(y, y, 1\right)} \cdot \left(\sqrt{\mathsf{fma}\left(y, y, 1\right)} \cdot x\right)
double f(double x, double y) {
        double r18463899 = x;
        double r18463900 = 1.0;
        double r18463901 = y;
        double r18463902 = r18463901 * r18463901;
        double r18463903 = r18463900 + r18463902;
        double r18463904 = r18463899 * r18463903;
        return r18463904;
}

double f(double x, double y) {
        double r18463905 = y;
        double r18463906 = 1.0;
        double r18463907 = fma(r18463905, r18463905, r18463906);
        double r18463908 = sqrt(r18463907);
        double r18463909 = x;
        double r18463910 = r18463908 * r18463909;
        double r18463911 = r18463908 * r18463910;
        return r18463911;
}

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. Using strategy rm
  4. Applied add-sqr-sqrt5.3

    \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(y, y, 1\right)} \cdot \sqrt{\mathsf{fma}\left(y, y, 1\right)}\right)} \cdot x\]
  5. Applied associate-*l*5.3

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

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

Reproduce

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