Average Error: 0.3 → 0.2
Time: 51.5s
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 r31665953 = 3.0;
        double r31665954 = 2.0;
        double r31665955 = x;
        double r31665956 = r31665955 * r31665953;
        double r31665957 = r31665954 - r31665956;
        double r31665958 = r31665953 * r31665957;
        double r31665959 = r31665958 * r31665955;
        return r31665959;
}

double f(double x) {
        double r31665960 = 6.0;
        double r31665961 = x;
        double r31665962 = 9.0;
        double r31665963 = r31665961 * r31665962;
        double r31665964 = r31665960 - r31665963;
        double r31665965 = r31665964 * r31665961;
        return r31665965;
}

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. Using strategy rm
  3. Applied associate-*l*0.3

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

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

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

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

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(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))