Average Error: 0.3 → 0.2
Time: 2.5s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[\left(6 - 9 \cdot x\right) \cdot x\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
\left(6 - 9 \cdot x\right) \cdot x
double f(double x) {
        double r658295 = 3.0;
        double r658296 = 2.0;
        double r658297 = x;
        double r658298 = r658297 * r658295;
        double r658299 = r658296 - r658298;
        double r658300 = r658295 * r658299;
        double r658301 = r658300 * r658297;
        return r658301;
}

double f(double x) {
        double r658302 = 6.0;
        double r658303 = 9.0;
        double r658304 = x;
        double r658305 = r658303 * r658304;
        double r658306 = r658302 - r658305;
        double r658307 = r658306 * r658304;
        return r658307;
}

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

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

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

Reproduce

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