Average Error: 0.2 → 0.1
Time: 2.3s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[9 \cdot {x}^{2} + \left(3 - 12 \cdot x\right)\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
9 \cdot {x}^{2} + \left(3 - 12 \cdot x\right)
double f(double x) {
        double r741301 = 3.0;
        double r741302 = x;
        double r741303 = r741302 * r741301;
        double r741304 = r741303 * r741302;
        double r741305 = 4.0;
        double r741306 = r741302 * r741305;
        double r741307 = r741304 - r741306;
        double r741308 = 1.0;
        double r741309 = r741307 + r741308;
        double r741310 = r741301 * r741309;
        return r741310;
}

double f(double x) {
        double r741311 = 9.0;
        double r741312 = x;
        double r741313 = 2.0;
        double r741314 = pow(r741312, r741313);
        double r741315 = r741311 * r741314;
        double r741316 = 3.0;
        double r741317 = 12.0;
        double r741318 = r741317 * r741312;
        double r741319 = r741316 - r741318;
        double r741320 = r741315 + r741319;
        return r741320;
}

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. Simplified0.1

    \[\leadsto \color{blue}{3 \cdot \left(1 + x \cdot \left(x \cdot 3 - 4\right)\right)}\]
  3. Taylor expanded around 0 0.1

    \[\leadsto \color{blue}{\left(9 \cdot {x}^{2} + 3\right) - 12 \cdot x}\]
  4. Using strategy rm
  5. Applied associate--l+0.1

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

    \[\leadsto 9 \cdot {x}^{2} + \left(3 - 12 \cdot x\right)\]

Reproduce

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