Average Error: 0.2 → 0.1
Time: 11.1s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[\left(x \cdot x\right) \cdot 9 + \left(3 - x \cdot 12\right)\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
\left(x \cdot x\right) \cdot 9 + \left(3 - x \cdot 12\right)
double f(double x) {
        double r520218 = 3.0;
        double r520219 = x;
        double r520220 = r520219 * r520218;
        double r520221 = r520220 * r520219;
        double r520222 = 4.0;
        double r520223 = r520219 * r520222;
        double r520224 = r520221 - r520223;
        double r520225 = 1.0;
        double r520226 = r520224 + r520225;
        double r520227 = r520218 * r520226;
        return r520227;
}

double f(double x) {
        double r520228 = x;
        double r520229 = r520228 * r520228;
        double r520230 = 9.0;
        double r520231 = r520229 * r520230;
        double r520232 = 3.0;
        double r520233 = 12.0;
        double r520234 = r520228 * r520233;
        double r520235 = r520232 - r520234;
        double r520236 = r520231 + r520235;
        return r520236;
}

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

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

Reproduce

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