Average Error: 0.1 → 0.1
Time: 9.7s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[3 - \left(12 - 9 \cdot x\right) \cdot x\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
3 - \left(12 - 9 \cdot x\right) \cdot x
double f(double x) {
        double r580159 = 3.0;
        double r580160 = x;
        double r580161 = r580160 * r580159;
        double r580162 = r580161 * r580160;
        double r580163 = 4.0;
        double r580164 = r580160 * r580163;
        double r580165 = r580162 - r580164;
        double r580166 = 1.0;
        double r580167 = r580165 + r580166;
        double r580168 = r580159 * r580167;
        return r580168;
}

double f(double x) {
        double r580169 = 3.0;
        double r580170 = 12.0;
        double r580171 = 9.0;
        double r580172 = x;
        double r580173 = r580171 * r580172;
        double r580174 = r580170 - r580173;
        double r580175 = r580174 * r580172;
        double r580176 = r580169 - r580175;
        return r580176;
}

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

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

Reproduce

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