Average Error: 0.3 → 0.2
Time: 13.0s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[x \cdot 6 + \left(-9 \cdot {x}^{2}\right)\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
x \cdot 6 + \left(-9 \cdot {x}^{2}\right)
double f(double x) {
        double r582982 = 3.0;
        double r582983 = 2.0;
        double r582984 = x;
        double r582985 = r582984 * r582982;
        double r582986 = r582983 - r582985;
        double r582987 = r582982 * r582986;
        double r582988 = r582987 * r582984;
        return r582988;
}

double f(double x) {
        double r582989 = x;
        double r582990 = 6.0;
        double r582991 = r582989 * r582990;
        double r582992 = 9.0;
        double r582993 = 2.0;
        double r582994 = pow(r582989, r582993);
        double r582995 = r582992 * r582994;
        double r582996 = -r582995;
        double r582997 = r582991 + r582996;
        return r582997;
}

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. 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. Using strategy rm
  5. Applied sub-neg0.2

    \[\leadsto x \cdot \color{blue}{\left(6 + \left(-9 \cdot x\right)\right)}\]
  6. Applied distribute-lft-in0.2

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

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

    \[\leadsto x \cdot 6 + \left(-9 \cdot {x}^{2}\right)\]

Reproduce

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