Average Error: 5.5 → 5.5
Time: 8.7s
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 r245991 = x;
        double r245992 = 1.0;
        double r245993 = y;
        double r245994 = r245993 * r245993;
        double r245995 = r245992 + r245994;
        double r245996 = r245991 * r245995;
        return r245996;
}

double f(double x, double y) {
        double r245997 = y;
        double r245998 = 1.0;
        double r245999 = fma(r245997, r245997, r245998);
        double r246000 = sqrt(r245999);
        double r246001 = x;
        double r246002 = r246000 * r246001;
        double r246003 = r246000 * r246002;
        return r246003;
}

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 2019212 +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))))