Average Error: 0.1 → 0.1
Time: 2.3s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[\left(9 \cdot {x}^{2} + 3\right) - 12 \cdot x\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
\left(9 \cdot {x}^{2} + 3\right) - 12 \cdot x
double f(double x) {
        double r512540 = 3.0;
        double r512541 = x;
        double r512542 = r512541 * r512540;
        double r512543 = r512542 * r512541;
        double r512544 = 4.0;
        double r512545 = r512541 * r512544;
        double r512546 = r512543 - r512545;
        double r512547 = 1.0;
        double r512548 = r512546 + r512547;
        double r512549 = r512540 * r512548;
        return r512549;
}

double f(double x) {
        double r512550 = 9.0;
        double r512551 = x;
        double r512552 = 2.0;
        double r512553 = pow(r512551, r512552);
        double r512554 = r512550 * r512553;
        double r512555 = 3.0;
        double r512556 = r512554 + r512555;
        double r512557 = 12.0;
        double r512558 = r512557 * r512551;
        double r512559 = r512556 - r512558;
        return r512559;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.1
Target0.1
Herbie0.1
\[3 + \left(\left(9 \cdot x\right) \cdot x - 12 \cdot x\right)\]

Derivation

  1. Initial program 0.1

    \[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. Final simplification0.1

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

Reproduce

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