Average Error: 5.5 → 5.5
Time: 16.1s
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 r51092199 = x;
        double r51092200 = 1.0;
        double r51092201 = y;
        double r51092202 = r51092201 * r51092201;
        double r51092203 = r51092200 + r51092202;
        double r51092204 = r51092199 * r51092203;
        return r51092204;
}

double f(double x, double y) {
        double r51092205 = y;
        double r51092206 = 1.0;
        double r51092207 = fma(r51092205, r51092205, r51092206);
        double r51092208 = sqrt(r51092207);
        double r51092209 = x;
        double r51092210 = r51092208 * r51092209;
        double r51092211 = r51092208 * r51092210;
        return r51092211;
}

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

    \[\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.5

    \[\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.5

    \[\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 2019173 +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))))