Average Error: 0.3 → 0.2
Time: 9.6s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[\left(-\left(3 \cdot 3\right) \cdot \left(x \cdot x\right)\right) + \left(x \cdot 2\right) \cdot 3\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
\left(-\left(3 \cdot 3\right) \cdot \left(x \cdot x\right)\right) + \left(x \cdot 2\right) \cdot 3
double f(double x) {
        double r573156 = 3.0;
        double r573157 = 2.0;
        double r573158 = x;
        double r573159 = r573158 * r573156;
        double r573160 = r573157 - r573159;
        double r573161 = r573156 * r573160;
        double r573162 = r573161 * r573158;
        return r573162;
}

double f(double x) {
        double r573163 = 3.0;
        double r573164 = r573163 * r573163;
        double r573165 = x;
        double r573166 = r573165 * r573165;
        double r573167 = r573164 * r573166;
        double r573168 = -r573167;
        double r573169 = 2.0;
        double r573170 = r573165 * r573169;
        double r573171 = r573170 * r573163;
        double r573172 = r573168 + r573171;
        return r573172;
}

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. Simplified0.3

    \[\leadsto 3 \cdot \color{blue}{\left(x \cdot \left(2 - x \cdot 3\right)\right)}\]
  5. Using strategy rm
  6. Applied sub-neg0.3

    \[\leadsto 3 \cdot \left(x \cdot \color{blue}{\left(2 + \left(-x \cdot 3\right)\right)}\right)\]
  7. Applied distribute-rgt-in0.3

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

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

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

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

Reproduce

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