Average Error: 0.2 → 0.1
Time: 37.2s
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 r31236890 = 3.0;
        double r31236891 = x;
        double r31236892 = r31236891 * r31236890;
        double r31236893 = r31236892 * r31236891;
        double r31236894 = 4.0;
        double r31236895 = r31236891 * r31236894;
        double r31236896 = r31236893 - r31236895;
        double r31236897 = 1.0;
        double r31236898 = r31236896 + r31236897;
        double r31236899 = r31236890 * r31236898;
        return r31236899;
}

double f(double x) {
        double r31236900 = x;
        double r31236901 = 9.0;
        double r31236902 = r31236900 * r31236901;
        double r31236903 = 12.0;
        double r31236904 = r31236902 - r31236903;
        double r31236905 = r31236904 * r31236900;
        double r31236906 = 3.0;
        double r31236907 = r31236905 + r31236906;
        return r31236907;
}

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.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 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)))