Average Error: 0.2 → 0.1
Time: 11.4s
Precision: 64
\[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)\]
\[\left(3 \cdot x\right) \cdot x + {x}^{3} \cdot \left(-2\right)\]
\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)
\left(3 \cdot x\right) \cdot x + {x}^{3} \cdot \left(-2\right)
double f(double x) {
        double r535443 = x;
        double r535444 = r535443 * r535443;
        double r535445 = 3.0;
        double r535446 = 2.0;
        double r535447 = r535443 * r535446;
        double r535448 = r535445 - r535447;
        double r535449 = r535444 * r535448;
        return r535449;
}

double f(double x) {
        double r535450 = 3.0;
        double r535451 = x;
        double r535452 = r535450 * r535451;
        double r535453 = r535452 * r535451;
        double r535454 = 3.0;
        double r535455 = pow(r535451, r535454);
        double r535456 = 2.0;
        double r535457 = -r535456;
        double r535458 = r535455 * r535457;
        double r535459 = r535453 + r535458;
        return r535459;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.2
Target0.2
Herbie0.1
\[x \cdot \left(x \cdot \left(3 - x \cdot 2\right)\right)\]

Derivation

  1. Initial program 0.2

    \[\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)\]
  2. Simplified0.2

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-x, 2, 3\right) \cdot x\right) \cdot x}\]
  3. Taylor expanded around 0 0.1

    \[\leadsto \color{blue}{3 \cdot {x}^{2} - 2 \cdot {x}^{3}}\]
  4. Simplified0.2

    \[\leadsto \color{blue}{{x}^{2} \cdot \left(3 - x \cdot 2\right)}\]
  5. Using strategy rm
  6. Applied sub-neg0.2

    \[\leadsto {x}^{2} \cdot \color{blue}{\left(3 + \left(-x \cdot 2\right)\right)}\]
  7. Applied distribute-lft-in0.2

    \[\leadsto \color{blue}{{x}^{2} \cdot 3 + {x}^{2} \cdot \left(-x \cdot 2\right)}\]
  8. Simplified0.2

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

    \[\leadsto \left(3 \cdot x\right) \cdot x + \color{blue}{\left(-2\right) \cdot {x}^{3}}\]
  10. Final simplification0.1

    \[\leadsto \left(3 \cdot x\right) \cdot x + {x}^{3} \cdot \left(-2\right)\]

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(FPCore (x)
  :name "Data.Spline.Key:interpolateKeys from smoothie-0.4.0.2"

  :herbie-target
  (* x (* x (- 3.0 (* x 2.0))))

  (* (* x x) (- 3.0 (* x 2.0))))