Average Error: 0.1 → 0.1
Time: 2.1s
Precision: 64
\[3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)\]
\[\left(9 \cdot {x}^{2} + 3\right) - 12 \cdot x\]
3 \cdot \left(\left(\left(x \cdot 3\right) \cdot x - x \cdot 4\right) + 1\right)
\left(9 \cdot {x}^{2} + 3\right) - 12 \cdot x
double f(double x) {
        double r689888 = 3.0;
        double r689889 = x;
        double r689890 = r689889 * r689888;
        double r689891 = r689890 * r689889;
        double r689892 = 4.0;
        double r689893 = r689889 * r689892;
        double r689894 = r689891 - r689893;
        double r689895 = 1.0;
        double r689896 = r689894 + r689895;
        double r689897 = r689888 * r689896;
        return r689897;
}

double f(double x) {
        double r689898 = 9.0;
        double r689899 = x;
        double r689900 = 2.0;
        double r689901 = pow(r689899, r689900);
        double r689902 = r689898 * r689901;
        double r689903 = 3.0;
        double r689904 = r689902 + r689903;
        double r689905 = 12.0;
        double r689906 = r689905 * r689899;
        double r689907 = r689904 - r689906;
        return r689907;
}

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

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

Reproduce

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