Average Error: 0.3 → 0.2
Time: 8.3s
Precision: 64
\[\left(3.0 \cdot \left(2.0 - x \cdot 3.0\right)\right) \cdot x\]
\[\left(6.0 - x \cdot 9.0\right) \cdot x\]
\left(3.0 \cdot \left(2.0 - x \cdot 3.0\right)\right) \cdot x
\left(6.0 - x \cdot 9.0\right) \cdot x
double f(double x) {
        double r36053065 = 3.0;
        double r36053066 = 2.0;
        double r36053067 = x;
        double r36053068 = r36053067 * r36053065;
        double r36053069 = r36053066 - r36053068;
        double r36053070 = r36053065 * r36053069;
        double r36053071 = r36053070 * r36053067;
        return r36053071;
}

double f(double x) {
        double r36053072 = 6.0;
        double r36053073 = x;
        double r36053074 = 9.0;
        double r36053075 = r36053073 * r36053074;
        double r36053076 = r36053072 - r36053075;
        double r36053077 = r36053076 * r36053073;
        return r36053077;
}

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.0 \cdot x - 9.0 \cdot \left(x \cdot x\right)\]

Derivation

  1. Initial program 0.3

    \[\left(3.0 \cdot \left(2.0 - x \cdot 3.0\right)\right) \cdot x\]
  2. Taylor expanded around 0 0.2

    \[\leadsto \color{blue}{6.0 \cdot x - 9.0 \cdot {x}^{2}}\]
  3. Simplified0.2

    \[\leadsto \color{blue}{x \cdot \left(6.0 - x \cdot 9.0\right)}\]
  4. Final simplification0.2

    \[\leadsto \left(6.0 - x \cdot 9.0\right) \cdot x\]

Reproduce

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