Average Error: 0.0 → 0.0
Time: 26.7s
Precision: 64
\[0 \le x \le 2\]
\[x \cdot \left(x \cdot x\right) + x \cdot x\]
\[\frac{(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) + \left(x \cdot x\right))_*}{\left(1 - x\right) + x \cdot x}\]
x \cdot \left(x \cdot x\right) + x \cdot x
\frac{(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) + \left(x \cdot x\right))_*}{\left(1 - x\right) + x \cdot x}
double f(double x) {
        double r7942065 = x;
        double r7942066 = r7942065 * r7942065;
        double r7942067 = r7942065 * r7942066;
        double r7942068 = r7942067 + r7942066;
        return r7942068;
}

double f(double x) {
        double r7942069 = x;
        double r7942070 = r7942069 * r7942069;
        double r7942071 = r7942069 * r7942070;
        double r7942072 = fma(r7942070, r7942071, r7942070);
        double r7942073 = 1.0;
        double r7942074 = r7942073 - r7942069;
        double r7942075 = r7942074 + r7942070;
        double r7942076 = r7942072 / r7942075;
        return r7942076;
}

Error

Bits error versus x

Target

Original0.0
Target0.0
Herbie0.0
\[\left(\left(1.0 + x\right) \cdot x\right) \cdot x\]

Derivation

  1. Initial program 0.0

    \[x \cdot \left(x \cdot x\right) + x \cdot x\]
  2. Using strategy rm
  3. Applied distribute-lft1-in0.0

    \[\leadsto \color{blue}{\left(x + 1\right) \cdot \left(x \cdot x\right)}\]
  4. Using strategy rm
  5. Applied flip3-+0.0

    \[\leadsto \color{blue}{\frac{{x}^{3} + {1}^{3}}{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)}} \cdot \left(x \cdot x\right)\]
  6. Applied associate-*l/0.0

    \[\leadsto \color{blue}{\frac{\left({x}^{3} + {1}^{3}\right) \cdot \left(x \cdot x\right)}{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)}}\]
  7. Simplified0.0

    \[\leadsto \frac{\color{blue}{(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) + \left(x \cdot x\right))_*}}{x \cdot x + \left(1 \cdot 1 - x \cdot 1\right)}\]
  8. Final simplification0.0

    \[\leadsto \frac{(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) + \left(x \cdot x\right))_*}{\left(1 - x\right) + x \cdot x}\]

Reproduce

herbie shell --seed 2019119 +o rules:numerics
(FPCore (x)
  :name "Expression 3, p15"
  :pre (<= 0 x 2)

  :herbie-target
  (* (* (+ 1.0 x) x) x)

  (+ (* x (* x x)) (* x x)))