Average Error: 0.2 → 0.1
Time: 1.9s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[x \cdot \left(9 \cdot x - 12\right) + 3\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
x \cdot \left(9 \cdot x - 12\right) + 3
double f(double x) {
        double r750868 = 3.0;
        double r750869 = x;
        double r750870 = r750869 * r750868;
        double r750871 = r750870 * r750869;
        double r750872 = 4.0;
        double r750873 = r750869 * r750872;
        double r750874 = r750871 - r750873;
        double r750875 = 1.0;
        double r750876 = r750874 + r750875;
        double r750877 = r750868 * r750876;
        return r750877;
}

double f(double x) {
        double r750878 = x;
        double r750879 = 9.0;
        double r750880 = r750879 * r750878;
        double r750881 = 12.0;
        double r750882 = r750880 - r750881;
        double r750883 = r750878 * r750882;
        double r750884 = 3.0;
        double r750885 = r750883 + r750884;
        return r750885;
}

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 + 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. Taylor expanded around 0 0.1

    \[\leadsto \color{blue}{\left(9 \cdot {x}^{2} + 3\right) - 12 \cdot x}\]
  5. Simplified0.1

    \[\leadsto \color{blue}{x \cdot \left(9 \cdot x - 12\right) + 3}\]
  6. Final simplification0.1

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

Reproduce

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