Average Error: 0.2 → 0.2
Time: 2.3s
Precision: 64
\[\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x\]
\[x \cdot \left(6 - x \cdot 9\right)\]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
x \cdot \left(6 - x \cdot 9\right)
double f(double x) {
        double r704311 = 3.0;
        double r704312 = 2.0;
        double r704313 = x;
        double r704314 = r704313 * r704311;
        double r704315 = r704312 - r704314;
        double r704316 = r704311 * r704315;
        double r704317 = r704316 * r704313;
        return r704317;
}

double f(double x) {
        double r704318 = x;
        double r704319 = 6.0;
        double r704320 = 9.0;
        double r704321 = r704318 * r704320;
        double r704322 = r704319 - r704321;
        double r704323 = r704318 * r704322;
        return r704323;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.2
Target0.2
Herbie0.2
\[6 \cdot x - 9 \cdot \left(x \cdot x\right)\]

Derivation

  1. Initial program 0.2

    \[\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. 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 - x \cdot 9\right)}\]
  6. Final simplification0.2

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

Reproduce

herbie shell --seed 2020027 +o rules:numerics
(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))