Average Error: 0.0 → 0.0
Time: 29.7s
Precision: 64
\[0 \le x \le 2\]
\[x \cdot \left(x \cdot x\right) + x \cdot x\]
\[\mathsf{fma}\left(x, x, {\left(\frac{1}{x}\right)}^{-3}\right)\]
x \cdot \left(x \cdot x\right) + x \cdot x
\mathsf{fma}\left(x, x, {\left(\frac{1}{x}\right)}^{-3}\right)
double f(double x) {
        double r3214165 = x;
        double r3214166 = r3214165 * r3214165;
        double r3214167 = r3214165 * r3214166;
        double r3214168 = r3214167 + r3214166;
        return r3214168;
}

double f(double x) {
        double r3214169 = x;
        double r3214170 = 1.0;
        double r3214171 = r3214170 / r3214169;
        double r3214172 = -3.0;
        double r3214173 = pow(r3214171, r3214172);
        double r3214174 = fma(r3214169, r3214169, r3214173);
        return r3214174;
}

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. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, x \cdot x, x \cdot x\right)}\]
  3. Using strategy rm
  4. Applied add-cbrt-cube20.2

    \[\leadsto \color{blue}{\sqrt[3]{\left(\mathsf{fma}\left(x, x \cdot x, x \cdot x\right) \cdot \mathsf{fma}\left(x, x \cdot x, x \cdot x\right)\right) \cdot \mathsf{fma}\left(x, x \cdot x, x \cdot x\right)}}\]
  5. Using strategy rm
  6. Applied fma-udef20.2

    \[\leadsto \sqrt[3]{\left(\mathsf{fma}\left(x, x \cdot x, x \cdot x\right) \cdot \mathsf{fma}\left(x, x \cdot x, x \cdot x\right)\right) \cdot \color{blue}{\left(x \cdot \left(x \cdot x\right) + x \cdot x\right)}}\]
  7. Applied distribute-lft-in20.2

    \[\leadsto \sqrt[3]{\color{blue}{\left(\mathsf{fma}\left(x, x \cdot x, x \cdot x\right) \cdot \mathsf{fma}\left(x, x \cdot x, x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) + \left(\mathsf{fma}\left(x, x \cdot x, x \cdot x\right) \cdot \mathsf{fma}\left(x, x \cdot x, x \cdot x\right)\right) \cdot \left(x \cdot x\right)}}\]
  8. Taylor expanded around inf 0.0

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, {\left(\frac{1}{x}\right)}^{-3}\right)}\]
  10. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(x, x, {\left(\frac{1}{x}\right)}^{-3}\right)\]

Reproduce

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