Average Error: 0.3 → 0.2
Time: 9.0s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[6 \cdot x - 9 \cdot {x}^{2}\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
6 \cdot x - 9 \cdot {x}^{2}
double f(double x) {
        double r589947 = 3.0;
        double r589948 = 2.0;
        double r589949 = x;
        double r589950 = r589949 * r589947;
        double r589951 = r589948 - r589950;
        double r589952 = r589947 * r589951;
        double r589953 = r589952 * r589949;
        return r589953;
}

double f(double x) {
        double r589954 = 6.0;
        double r589955 = x;
        double r589956 = r589954 * r589955;
        double r589957 = 9.0;
        double r589958 = 2.0;
        double r589959 = pow(r589955, r589958);
        double r589960 = r589957 * r589959;
        double r589961 = r589956 - r589960;
        return r589961;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 0.3

    \[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
  2. Taylor expanded around 0 0.2

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

    \[\leadsto \color{blue}{x \cdot \left(6 - 9 \cdot x\right)}\]
  4. Using strategy rm
  5. Applied flip--0.3

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

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

    \[\leadsto 6 \cdot x - 9 \cdot {x}^{2}\]

Reproduce

herbie shell --seed 2020045 
(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))