Average Error: 0.3 → 0.2
Time: 2.6s
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 r701081 = 3.0;
        double r701082 = 2.0;
        double r701083 = x;
        double r701084 = r701083 * r701081;
        double r701085 = r701082 - r701084;
        double r701086 = r701081 * r701085;
        double r701087 = r701086 * r701083;
        return r701087;
}

double f(double x) {
        double r701088 = x;
        double r701089 = 6.0;
        double r701090 = 9.0;
        double r701091 = r701088 * r701090;
        double r701092 = r701089 - r701091;
        double r701093 = r701088 * r701092;
        return r701093;
}

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

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

Reproduce

herbie shell --seed 2020062 +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))