Average Error: 0.3 → 0.2
Time: 8.6s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[x \cdot 6 - 9 \cdot \left(x \cdot x\right)\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
x \cdot 6 - 9 \cdot \left(x \cdot x\right)
double f(double x) {
        double r627772 = 3.0;
        double r627773 = 2.0;
        double r627774 = x;
        double r627775 = r627774 * r627772;
        double r627776 = r627773 - r627775;
        double r627777 = r627772 * r627776;
        double r627778 = r627777 * r627774;
        return r627778;
}

double f(double x) {
        double r627779 = x;
        double r627780 = 6.0;
        double r627781 = r627779 * r627780;
        double r627782 = 9.0;
        double r627783 = r627779 * r627779;
        double r627784 = r627782 * r627783;
        double r627785 = r627781 - r627784;
        return r627785;
}

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}{x \cdot \left(\left(2 - 3 \cdot x\right) \cdot 3\right)}\]
  3. Using strategy rm
  4. Applied associate-*r*0.3

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

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

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

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

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

Reproduce

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