Average Error: 0.1 → 0.1
Time: 18.9s
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 r32622590 = 3.0;
        double r32622591 = x;
        double r32622592 = r32622591 * r32622590;
        double r32622593 = r32622592 * r32622591;
        double r32622594 = 4.0;
        double r32622595 = r32622591 * r32622594;
        double r32622596 = r32622593 - r32622595;
        double r32622597 = 1.0;
        double r32622598 = r32622596 + r32622597;
        double r32622599 = r32622590 * r32622598;
        return r32622599;
}

double f(double x) {
        double r32622600 = x;
        double r32622601 = 9.0;
        double r32622602 = r32622600 * r32622601;
        double r32622603 = 12.0;
        double r32622604 = r32622602 - r32622603;
        double r32622605 = r32622604 * r32622600;
        double r32622606 = 3.0;
        double r32622607 = r32622605 + r32622606;
        return r32622607;
}

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 - \left(4 - x \cdot 3\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}{x \cdot \left(x \cdot 9 - 12\right) + 3}\]
  5. Final simplification0.1

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

Reproduce

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