Average Error: 0.2 → 0.1
Time: 2.0s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[\left(\left(x \cdot 9\right) \cdot {x}^{1} + 3\right) - 12 \cdot x\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
\left(\left(x \cdot 9\right) \cdot {x}^{1} + 3\right) - 12 \cdot x
double f(double x) {
        double r715888 = 3.0;
        double r715889 = x;
        double r715890 = r715889 * r715888;
        double r715891 = r715890 * r715889;
        double r715892 = 4.0;
        double r715893 = r715889 * r715892;
        double r715894 = r715891 - r715893;
        double r715895 = 1.0;
        double r715896 = r715894 + r715895;
        double r715897 = r715888 * r715896;
        return r715897;
}

double f(double x) {
        double r715898 = x;
        double r715899 = 9.0;
        double r715900 = r715898 * r715899;
        double r715901 = 1.0;
        double r715902 = pow(r715898, r715901);
        double r715903 = r715900 * r715902;
        double r715904 = 3.0;
        double r715905 = r715903 + r715904;
        double r715906 = 12.0;
        double r715907 = r715906 * r715898;
        double r715908 = r715905 - r715907;
        return r715908;
}

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 + 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. Using strategy rm
  5. Applied sqr-pow0.1

    \[\leadsto \left(9 \cdot \color{blue}{\left({x}^{\left(\frac{2}{2}\right)} \cdot {x}^{\left(\frac{2}{2}\right)}\right)} + 3\right) - 12 \cdot x\]
  6. Applied associate-*r*0.1

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

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

    \[\leadsto \left(\left(x \cdot 9\right) \cdot {x}^{1} + 3\right) - 12 \cdot x\]

Reproduce

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