Average Error: 0.0 → 0.0
Time: 10.8s
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 r2107679 = x;
        double r2107680 = r2107679 * r2107679;
        double r2107681 = r2107679 * r2107680;
        double r2107682 = r2107681 + r2107680;
        return r2107682;
}

double f(double x) {
        double r2107683 = x;
        double r2107684 = 1.0;
        double r2107685 = r2107684 / r2107683;
        double r2107686 = -3.0;
        double r2107687 = pow(r2107685, r2107686);
        double r2107688 = fma(r2107683, r2107683, r2107687);
        return r2107688;
}

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 \cdot x, 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 \cdot x, x, x \cdot x\right) \cdot \mathsf{fma}\left(x \cdot x, x, x \cdot x\right)\right) \cdot \mathsf{fma}\left(x \cdot x, x, x \cdot x\right)}}\]
  5. Using strategy rm
  6. Applied fma-udef20.2

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

    \[\leadsto \sqrt[3]{\color{blue}{\left(\mathsf{fma}\left(x \cdot x, x, x \cdot x\right) \cdot \mathsf{fma}\left(x \cdot x, x, x \cdot x\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) + \left(\mathsf{fma}\left(x \cdot x, x, x \cdot x\right) \cdot \mathsf{fma}\left(x \cdot x, 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)))