Average Error: 0.2 → 0.2
Time: 10.0s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[x \cdot \left(6 - x \cdot 9\right)\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
x \cdot \left(6 - x \cdot 9\right)
double f(double x) {
        double r579342 = 3.0;
        double r579343 = 2.0;
        double r579344 = x;
        double r579345 = r579344 * r579342;
        double r579346 = r579343 - r579345;
        double r579347 = r579342 * r579346;
        double r579348 = r579347 * r579344;
        return r579348;
}

double f(double x) {
        double r579349 = x;
        double r579350 = 6.0;
        double r579351 = 9.0;
        double r579352 = r579349 * r579351;
        double r579353 = r579350 - r579352;
        double r579354 = r579349 * r579353;
        return r579354;
}

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.2
\[6 \cdot x - 9 \cdot \left(x \cdot x\right)\]

Derivation

  1. Initial program 0.2

    \[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
  2. Using strategy rm
  3. Applied flip--0.3

    \[\leadsto \left(3 \cdot \color{blue}{\frac{2 \cdot 2 - \left(x \cdot 3\right) \cdot \left(x \cdot 3\right)}{2 + x \cdot 3}}\right) \cdot x\]
  4. Applied associate-*r/0.3

    \[\leadsto \color{blue}{\frac{3 \cdot \left(2 \cdot 2 - \left(x \cdot 3\right) \cdot \left(x \cdot 3\right)\right)}{2 + x \cdot 3}} \cdot x\]
  5. Taylor expanded around 0 0.2

    \[\leadsto \color{blue}{6 \cdot x - 9 \cdot {x}^{2}}\]
  6. Final simplification0.2

    \[\leadsto x \cdot \left(6 - x \cdot 9\right)\]

Reproduce

herbie shell --seed 2019297 
(FPCore (x)
  :name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, E"
  :precision binary64

  :herbie-target
  (- (* 6 x) (* 9 (* x x)))

  (* (* 3 (- 2 (* x 3))) x))