Average Error: 0.2 → 0.2
Time: 12.5s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[x \cdot \left(6 - 9 \cdot x\right)\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
x \cdot \left(6 - 9 \cdot x\right)
double f(double x) {
        double r501808 = 3.0;
        double r501809 = 2.0;
        double r501810 = x;
        double r501811 = r501810 * r501808;
        double r501812 = r501809 - r501811;
        double r501813 = r501808 * r501812;
        double r501814 = r501813 * r501810;
        return r501814;
}

double f(double x) {
        double r501815 = x;
        double r501816 = 6.0;
        double r501817 = 9.0;
        double r501818 = r501817 * r501815;
        double r501819 = r501816 - r501818;
        double r501820 = r501815 * r501819;
        return r501820;
}

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}{6 \cdot x - 9 \cdot {x}^{2}}\]
  3. Simplified0.2

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

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

Reproduce

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

  :herbie-target
  (- (* 6 x) (* 9 (* x x)))

  (* (* 3 (- 2 (* x 3))) x))