Average Error: 0.3 → 0.2
Time: 9.1s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[6 \cdot x + \left(-9 \cdot {x}^{2}\right)\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
6 \cdot x + \left(-9 \cdot {x}^{2}\right)
double f(double x) {
        double r503823 = 3.0;
        double r503824 = 2.0;
        double r503825 = x;
        double r503826 = r503825 * r503823;
        double r503827 = r503824 - r503826;
        double r503828 = r503823 * r503827;
        double r503829 = r503828 * r503825;
        return r503829;
}

double f(double x) {
        double r503830 = 6.0;
        double r503831 = x;
        double r503832 = r503830 * r503831;
        double r503833 = 9.0;
        double r503834 = 2.0;
        double r503835 = pow(r503831, r503834);
        double r503836 = r503833 * r503835;
        double r503837 = -r503836;
        double r503838 = r503832 + r503837;
        return r503838;
}

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.2

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

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

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

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

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

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

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

Reproduce

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