Average Error: 0.2 → 0.1
Time: 10.5s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[\left(x \cdot 9 - 12\right) \cdot x + 3\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
\left(x \cdot 9 - 12\right) \cdot x + 3
double f(double x) {
        double r587365 = 3.0;
        double r587366 = x;
        double r587367 = r587366 * r587365;
        double r587368 = r587367 * r587366;
        double r587369 = 4.0;
        double r587370 = r587366 * r587369;
        double r587371 = r587368 - r587370;
        double r587372 = 1.0;
        double r587373 = r587371 + r587372;
        double r587374 = r587365 * r587373;
        return r587374;
}

double f(double x) {
        double r587375 = x;
        double r587376 = 9.0;
        double r587377 = r587375 * r587376;
        double r587378 = 12.0;
        double r587379 = r587377 - r587378;
        double r587380 = r587379 * r587375;
        double r587381 = 3.0;
        double r587382 = r587380 + r587381;
        return r587382;
}

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.2

    \[\leadsto \color{blue}{3 \cdot \left(1 + \left(3 \cdot x - 4\right) \cdot x\right)}\]
  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}{\left(3 - 12 \cdot x\right) + \left(x \cdot x\right) \cdot 9}\]
  5. Taylor expanded around 0 0.1

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

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

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

Reproduce

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