Average Error: 0.2 → 0.2
Time: 15.3s
Precision: 64
\[\left(3.0 \cdot \left(2.0 - x \cdot 3.0\right)\right) \cdot x\]
\[\left(6.0 - x \cdot 9.0\right) \cdot x\]
\left(3.0 \cdot \left(2.0 - x \cdot 3.0\right)\right) \cdot x
\left(6.0 - x \cdot 9.0\right) \cdot x
double f(double x) {
        double r34799510 = 3.0;
        double r34799511 = 2.0;
        double r34799512 = x;
        double r34799513 = r34799512 * r34799510;
        double r34799514 = r34799511 - r34799513;
        double r34799515 = r34799510 * r34799514;
        double r34799516 = r34799515 * r34799512;
        return r34799516;
}

double f(double x) {
        double r34799517 = 6.0;
        double r34799518 = x;
        double r34799519 = 9.0;
        double r34799520 = r34799518 * r34799519;
        double r34799521 = r34799517 - r34799520;
        double r34799522 = r34799521 * r34799518;
        return r34799522;
}

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.0 \cdot x - 9.0 \cdot \left(x \cdot x\right)\]

Derivation

  1. Initial program 0.2

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

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

    \[\leadsto \color{blue}{x \cdot \left(6.0 - 9.0 \cdot x\right)}\]
  4. Final simplification0.2

    \[\leadsto \left(6.0 - x \cdot 9.0\right) \cdot x\]

Reproduce

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

  :herbie-target
  (- (* 6.0 x) (* 9.0 (* x x)))

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