Average Error: 5.3 → 5.3
Time: 11.8s
Precision: 64
\[x \cdot \left(1 + y \cdot y\right)\]
\[\left(\sqrt{\mathsf{fma}\left(y, y, 1\right)} \cdot x\right) \cdot \sqrt{1 + y \cdot y}\]
x \cdot \left(1 + y \cdot y\right)
\left(\sqrt{\mathsf{fma}\left(y, y, 1\right)} \cdot x\right) \cdot \sqrt{1 + y \cdot y}
double f(double x, double y) {
        double r238216 = x;
        double r238217 = 1.0;
        double r238218 = y;
        double r238219 = r238218 * r238218;
        double r238220 = r238217 + r238219;
        double r238221 = r238216 * r238220;
        return r238221;
}

double f(double x, double y) {
        double r238222 = y;
        double r238223 = 1.0;
        double r238224 = fma(r238222, r238222, r238223);
        double r238225 = sqrt(r238224);
        double r238226 = x;
        double r238227 = r238225 * r238226;
        double r238228 = r238222 * r238222;
        double r238229 = r238223 + r238228;
        double r238230 = sqrt(r238229);
        double r238231 = r238227 * r238230;
        return r238231;
}

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

    \[\leadsto x \cdot \color{blue}{\left(\sqrt{1 + y \cdot y} \cdot \sqrt{1 + y \cdot y}\right)}\]
  4. Applied associate-*r*5.3

    \[\leadsto \color{blue}{\left(x \cdot \sqrt{1 + y \cdot y}\right) \cdot \sqrt{1 + y \cdot y}}\]
  5. Simplified5.3

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

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

Reproduce

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