Average Error: 0.2 → 0.3
Time: 12.9s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[3 \cdot \left(2 \cdot x - \left(x \cdot 3\right) \cdot x\right)\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
3 \cdot \left(2 \cdot x - \left(x \cdot 3\right) \cdot x\right)
double f(double x) {
        double r1394569 = 3.0;
        double r1394570 = 2.0;
        double r1394571 = x;
        double r1394572 = r1394571 * r1394569;
        double r1394573 = r1394570 - r1394572;
        double r1394574 = r1394569 * r1394573;
        double r1394575 = r1394574 * r1394571;
        return r1394575;
}

double f(double x) {
        double r1394576 = 3.0;
        double r1394577 = 2.0;
        double r1394578 = x;
        double r1394579 = r1394577 * r1394578;
        double r1394580 = r1394578 * r1394576;
        double r1394581 = r1394580 * r1394578;
        double r1394582 = r1394579 - r1394581;
        double r1394583 = r1394576 * r1394582;
        return r1394583;
}

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.3
\[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. Using strategy rm
  3. Applied add-sqr-sqrt0.9

    \[\leadsto \left(\color{blue}{\left(\sqrt{3} \cdot \sqrt{3}\right)} \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
  4. Applied associate-*l*0.8

    \[\leadsto \color{blue}{\left(\sqrt{3} \cdot \left(\sqrt{3} \cdot \left(2 - x \cdot 3\right)\right)\right)} \cdot x\]
  5. Using strategy rm
  6. Applied associate-*l*0.7

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

    \[\leadsto \color{blue}{2 \cdot \left(x \cdot {\left(\sqrt{3}\right)}^{2}\right) - 3 \cdot \left({x}^{2} \cdot {\left(\sqrt{3}\right)}^{2}\right)}\]
  8. Simplified0.3

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

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

Reproduce

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