Average Error: 0.3 → 0.2
Time: 9.2s
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 r33171941 = 3.0;
        double r33171942 = 2.0;
        double r33171943 = x;
        double r33171944 = r33171943 * r33171941;
        double r33171945 = r33171942 - r33171944;
        double r33171946 = r33171941 * r33171945;
        double r33171947 = r33171946 * r33171943;
        return r33171947;
}

double f(double x) {
        double r33171948 = 6.0;
        double r33171949 = x;
        double r33171950 = 9.0;
        double r33171951 = r33171949 * r33171950;
        double r33171952 = r33171948 - r33171951;
        double r33171953 = r33171952 * r33171949;
        return r33171953;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.3
Target0.2
Herbie0.2
\[6 \cdot x - 9 \cdot \left(x \cdot x\right)\]

Derivation

  1. Initial program 0.3

    \[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
  2. Simplified0.3

    \[\leadsto \color{blue}{\left(3 \cdot x\right) \cdot \left(2 - 3 \cdot x\right)}\]
  3. Taylor expanded around 0 0.2

    \[\leadsto \color{blue}{6 \cdot x - 9 \cdot {x}^{2}}\]
  4. Simplified0.2

    \[\leadsto \color{blue}{6 \cdot x - 9 \cdot \left(x \cdot x\right)}\]
  5. Taylor expanded around 0 0.2

    \[\leadsto \color{blue}{6 \cdot x - 9 \cdot {x}^{2}}\]
  6. Simplified0.2

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

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

Reproduce

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