Average Error: 0.2 → 0.2
Time: 16.0s
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 r36208425 = 3.0;
        double r36208426 = 2.0;
        double r36208427 = x;
        double r36208428 = r36208427 * r36208425;
        double r36208429 = r36208426 - r36208428;
        double r36208430 = r36208425 * r36208429;
        double r36208431 = r36208430 * r36208427;
        return r36208431;
}

double f(double x) {
        double r36208432 = 6.0;
        double r36208433 = x;
        double r36208434 = 9.0;
        double r36208435 = r36208433 * r36208434;
        double r36208436 = r36208432 - r36208435;
        double r36208437 = r36208436 * r36208433;
        return r36208437;
}

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 - x \cdot 9.0\right)}\]
  4. Final simplification0.2

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

Reproduce

herbie shell --seed 2019163 +o rules:numerics
(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))