Average Error: 0.2 → 0.1
Time: 16.6s
Precision: 64
\[3.0 \cdot \left(\left(\left(x \cdot 3.0\right) \cdot x - x \cdot 4.0\right) + 1.0\right)\]
\[\left(x \cdot 9.0 - 12.0\right) \cdot x + 3.0\]
3.0 \cdot \left(\left(\left(x \cdot 3.0\right) \cdot x - x \cdot 4.0\right) + 1.0\right)
\left(x \cdot 9.0 - 12.0\right) \cdot x + 3.0
double f(double x) {
        double r34886243 = 3.0;
        double r34886244 = x;
        double r34886245 = r34886244 * r34886243;
        double r34886246 = r34886245 * r34886244;
        double r34886247 = 4.0;
        double r34886248 = r34886244 * r34886247;
        double r34886249 = r34886246 - r34886248;
        double r34886250 = 1.0;
        double r34886251 = r34886249 + r34886250;
        double r34886252 = r34886243 * r34886251;
        return r34886252;
}

double f(double x) {
        double r34886253 = x;
        double r34886254 = 9.0;
        double r34886255 = r34886253 * r34886254;
        double r34886256 = 12.0;
        double r34886257 = r34886255 - r34886256;
        double r34886258 = r34886257 * r34886253;
        double r34886259 = 3.0;
        double r34886260 = r34886258 + r34886259;
        return r34886260;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.2
Target0.1
Herbie0.1
\[3.0 + \left(\left(9.0 \cdot x\right) \cdot x - 12.0 \cdot x\right)\]

Derivation

  1. Initial program 0.2

    \[3.0 \cdot \left(\left(\left(x \cdot 3.0\right) \cdot x - x \cdot 4.0\right) + 1.0\right)\]
  2. Simplified0.2

    \[\leadsto \color{blue}{3.0 \cdot \left(1.0 - \left(4.0 - x \cdot 3.0\right) \cdot x\right)}\]
  3. Taylor expanded around 0 0.1

    \[\leadsto \color{blue}{\left(9.0 \cdot {x}^{2} + 3.0\right) - 12.0 \cdot x}\]
  4. Simplified0.1

    \[\leadsto \color{blue}{x \cdot \left(x \cdot 9.0 - 12.0\right) + 3.0}\]
  5. Final simplification0.1

    \[\leadsto \left(x \cdot 9.0 - 12.0\right) \cdot x + 3.0\]

Reproduce

herbie shell --seed 2019163 
(FPCore (x)
  :name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, D"

  :herbie-target
  (+ 3.0 (- (* (* 9.0 x) x) (* 12.0 x)))

  (* 3.0 (+ (- (* (* x 3.0) x) (* x 4.0)) 1.0)))