Average Error: 0.2 → 0.2
Time: 10.1s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[\left(6 - x \cdot 9\right) \cdot x\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
\left(6 - x \cdot 9\right) \cdot x
double f(double x) {
        double r42582105 = 3.0;
        double r42582106 = 2.0;
        double r42582107 = x;
        double r42582108 = r42582107 * r42582105;
        double r42582109 = r42582106 - r42582108;
        double r42582110 = r42582105 * r42582109;
        double r42582111 = r42582110 * r42582107;
        return r42582111;
}

double f(double x) {
        double r42582112 = 6.0;
        double r42582113 = x;
        double r42582114 = 9.0;
        double r42582115 = r42582113 * r42582114;
        double r42582116 = r42582112 - r42582115;
        double r42582117 = r42582116 * r42582113;
        return r42582117;
}

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

Derivation

  1. Initial program 0.2

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

    \[\leadsto \color{blue}{\left(6 - 9 \cdot x\right)} \cdot x\]
  3. Final simplification0.2

    \[\leadsto \left(6 - x \cdot 9\right) \cdot x\]

Reproduce

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