Average Error: 0.1 → 0.1
Time: 2.5s
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 r688869 = 3.0;
        double r688870 = x;
        double r688871 = r688870 * r688869;
        double r688872 = r688871 * r688870;
        double r688873 = 4.0;
        double r688874 = r688870 * r688873;
        double r688875 = r688872 - r688874;
        double r688876 = 1.0;
        double r688877 = r688875 + r688876;
        double r688878 = r688869 * r688877;
        return r688878;
}

double f(double x) {
        double r688879 = 9.0;
        double r688880 = x;
        double r688881 = 2.0;
        double r688882 = pow(r688880, r688881);
        double r688883 = r688879 * r688882;
        double r688884 = 3.0;
        double r688885 = r688883 + r688884;
        double r688886 = 12.0;
        double r688887 = r688886 * r688880;
        double r688888 = r688885 - r688887;
        return r688888;
}

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 2020083 
(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)))