Average Error: 0.2 → 0.2
Time: 13.9s
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 r33965388 = 3.0;
        double r33965389 = 2.0;
        double r33965390 = x;
        double r33965391 = r33965390 * r33965388;
        double r33965392 = r33965389 - r33965391;
        double r33965393 = r33965388 * r33965392;
        double r33965394 = r33965393 * r33965390;
        return r33965394;
}

double f(double x) {
        double r33965395 = 6.0;
        double r33965396 = x;
        double r33965397 = 9.0;
        double r33965398 = r33965396 * r33965397;
        double r33965399 = r33965395 - r33965398;
        double r33965400 = r33965399 * r33965396;
        return r33965400;
}

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))