Average Error: 0.3 → 0.2
Time: 8.3s
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 r548202 = 3.0;
        double r548203 = 2.0;
        double r548204 = x;
        double r548205 = r548204 * r548202;
        double r548206 = r548203 - r548205;
        double r548207 = r548202 * r548206;
        double r548208 = r548207 * r548204;
        return r548208;
}

double f(double x) {
        double r548209 = x;
        double r548210 = 6.0;
        double r548211 = r548209 * r548210;
        double r548212 = 9.0;
        double r548213 = r548209 * r548209;
        double r548214 = r548212 * r548213;
        double r548215 = r548211 - r548214;
        return r548215;
}

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))