Average Error: 0.3 → 0.2
Time: 13.3s
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 r466058 = 3.0;
        double r466059 = 2.0;
        double r466060 = x;
        double r466061 = r466060 * r466058;
        double r466062 = r466059 - r466061;
        double r466063 = r466058 * r466062;
        double r466064 = r466063 * r466060;
        return r466064;
}

double f(double x) {
        double r466065 = x;
        double r466066 = 6.0;
        double r466067 = r466065 * r466066;
        double r466068 = 9.0;
        double r466069 = 2.0;
        double r466070 = pow(r466065, r466069);
        double r466071 = r466068 * r466070;
        double r466072 = -r466071;
        double r466073 = r466067 + r466072;
        return r466073;
}

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))