Average Error: 0.2 → 0.1
Time: 2.1s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[x \cdot \left(x \cdot 9 - 12\right) + 3\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
x \cdot \left(x \cdot 9 - 12\right) + 3
double f(double x) {
        double r686118 = 3.0;
        double r686119 = x;
        double r686120 = r686119 * r686118;
        double r686121 = r686120 * r686119;
        double r686122 = 4.0;
        double r686123 = r686119 * r686122;
        double r686124 = r686121 - r686123;
        double r686125 = 1.0;
        double r686126 = r686124 + r686125;
        double r686127 = r686118 * r686126;
        return r686127;
}

double f(double x) {
        double r686128 = x;
        double r686129 = 9.0;
        double r686130 = r686128 * r686129;
        double r686131 = 12.0;
        double r686132 = r686130 - r686131;
        double r686133 = r686128 * r686132;
        double r686134 = 3.0;
        double r686135 = r686133 + r686134;
        return r686135;
}

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 + \left(\left(9 \cdot x\right) \cdot x - 12 \cdot x\right)\]

Derivation

  1. Initial program 0.2

    \[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
  2. Taylor expanded around 0 0.1

    \[\leadsto \color{blue}{\left(9 \cdot {x}^{2} + 3\right) - 12 \cdot x}\]
  3. Taylor expanded around 0 0.1

    \[\leadsto \color{blue}{\left(9 \cdot {x}^{2} + 3\right) - 12 \cdot x}\]
  4. Simplified0.1

    \[\leadsto \color{blue}{x \cdot \left(x \cdot 9 - 12\right) + 3}\]
  5. Final simplification0.1

    \[\leadsto x \cdot \left(x \cdot 9 - 12\right) + 3\]

Reproduce

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

  :herbie-target
  (+ 3 (- (* (* 9 x) x) (* 12 x)))

  (* 3 (+ (- (* (* x 3) x) (* x 4)) 1)))