Average Error: 0.2 → 0.1
Time: 16.4s
Precision: 64
\[3.0 \cdot \left(\left(\left(x \cdot 3.0\right) \cdot x - x \cdot 4.0\right) + 1.0\right)\]
\[\left(x \cdot 9.0 - 12.0\right) \cdot x + 3.0\]
3.0 \cdot \left(\left(\left(x \cdot 3.0\right) \cdot x - x \cdot 4.0\right) + 1.0\right)
\left(x \cdot 9.0 - 12.0\right) \cdot x + 3.0
double f(double x) {
        double r37524165 = 3.0;
        double r37524166 = x;
        double r37524167 = r37524166 * r37524165;
        double r37524168 = r37524167 * r37524166;
        double r37524169 = 4.0;
        double r37524170 = r37524166 * r37524169;
        double r37524171 = r37524168 - r37524170;
        double r37524172 = 1.0;
        double r37524173 = r37524171 + r37524172;
        double r37524174 = r37524165 * r37524173;
        return r37524174;
}

double f(double x) {
        double r37524175 = x;
        double r37524176 = 9.0;
        double r37524177 = r37524175 * r37524176;
        double r37524178 = 12.0;
        double r37524179 = r37524177 - r37524178;
        double r37524180 = r37524179 * r37524175;
        double r37524181 = 3.0;
        double r37524182 = r37524180 + r37524181;
        return r37524182;
}

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.0 + \left(\left(9.0 \cdot x\right) \cdot x - 12.0 \cdot x\right)\]

Derivation

  1. Initial program 0.2

    \[3.0 \cdot \left(\left(\left(x \cdot 3.0\right) \cdot x - x \cdot 4.0\right) + 1.0\right)\]
  2. Simplified0.1

    \[\leadsto \color{blue}{3.0 \cdot \left(1.0 - \left(4.0 - x \cdot 3.0\right) \cdot x\right)}\]
  3. Taylor expanded around 0 0.1

    \[\leadsto \color{blue}{\left(9.0 \cdot {x}^{2} + 3.0\right) - 12.0 \cdot x}\]
  4. Simplified0.1

    \[\leadsto \color{blue}{x \cdot \left(9.0 \cdot x - 12.0\right) + 3.0}\]
  5. Final simplification0.1

    \[\leadsto \left(x \cdot 9.0 - 12.0\right) \cdot x + 3.0\]

Reproduce

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