Average Error: 0.2 → 0.2
Time: 11.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 r24268621 = 3.0;
        double r24268622 = 2.0;
        double r24268623 = x;
        double r24268624 = r24268623 * r24268621;
        double r24268625 = r24268622 - r24268624;
        double r24268626 = r24268621 * r24268625;
        double r24268627 = r24268626 * r24268623;
        return r24268627;
}

double f(double x) {
        double r24268628 = 6.0;
        double r24268629 = x;
        double r24268630 = 9.0;
        double r24268631 = r24268629 * r24268630;
        double r24268632 = r24268628 - r24268631;
        double r24268633 = r24268632 * r24268629;
        return r24268633;
}

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}{\left(6.0 - 9.0 \cdot x\right)} \cdot x\]
  3. Final simplification0.2

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

Reproduce

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