Average Error: 5.6 → 5.6
Time: 10.0s
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 r20009189 = x;
        double r20009190 = 1.0;
        double r20009191 = y;
        double r20009192 = r20009191 * r20009191;
        double r20009193 = r20009190 + r20009192;
        double r20009194 = r20009189 * r20009193;
        return r20009194;
}

double f(double x, double y) {
        double r20009195 = y;
        double r20009196 = 1.0;
        double r20009197 = fma(r20009195, r20009195, r20009196);
        double r20009198 = sqrt(r20009197);
        double r20009199 = x;
        double r20009200 = r20009198 * r20009199;
        double r20009201 = r20009198 * r20009200;
        return r20009201;
}

Error

Bits error versus x

Bits error versus y

Target

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

Derivation

  1. Initial program 5.6

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, y, 1\right) \cdot x}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt5.6

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

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

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