Average Error: 40.7 → 0.4
Time: 1.8m
Precision: 64
\[\frac{1}{{x}^{2}} \cdot \left(1 - \frac{\frac{\sin x}{x}}{\frac{1 - \cos x}{{x}^{2}}}\right)\]
\[\frac{\frac{1}{x}}{x} - \frac{\frac{\cos \left(x \cdot \frac{1}{2}\right)}{x}}{\sin \left(x \cdot \frac{1}{2}\right)}\]
\frac{1}{{x}^{2}} \cdot \left(1 - \frac{\frac{\sin x}{x}}{\frac{1 - \cos x}{{x}^{2}}}\right)
\frac{\frac{1}{x}}{x} - \frac{\frac{\cos \left(x \cdot \frac{1}{2}\right)}{x}}{\sin \left(x \cdot \frac{1}{2}\right)}
double f(double x) {
        double r6876208 = 1.0;
        double r6876209 = x;
        double r6876210 = 2.0;
        double r6876211 = pow(r6876209, r6876210);
        double r6876212 = r6876208 / r6876211;
        double r6876213 = sin(r6876209);
        double r6876214 = r6876213 / r6876209;
        double r6876215 = cos(r6876209);
        double r6876216 = r6876208 - r6876215;
        double r6876217 = r6876216 / r6876211;
        double r6876218 = r6876214 / r6876217;
        double r6876219 = r6876208 - r6876218;
        double r6876220 = r6876212 * r6876219;
        return r6876220;
}

double f(double x) {
        double r6876221 = 1.0;
        double r6876222 = x;
        double r6876223 = r6876221 / r6876222;
        double r6876224 = r6876223 / r6876222;
        double r6876225 = 0.5;
        double r6876226 = r6876222 * r6876225;
        double r6876227 = cos(r6876226);
        double r6876228 = r6876227 / r6876222;
        double r6876229 = sin(r6876226);
        double r6876230 = r6876228 / r6876229;
        double r6876231 = r6876224 - r6876230;
        return r6876231;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 40.7

    \[\frac{1}{{x}^{2}} \cdot \left(1 - \frac{\frac{\sin x}{x}}{\frac{1 - \cos x}{{x}^{2}}}\right)\]
  2. Simplified19.8

    \[\leadsto \color{blue}{\left(\frac{1}{x} - \frac{\sin x}{1 - \cos x}\right) \cdot \frac{1}{x}}\]
  3. Taylor expanded around -inf 19.8

    \[\leadsto \color{blue}{\frac{1}{{x}^{2}} - \frac{\sin x}{\left(1 - \cos x\right) \cdot x}}\]
  4. Simplified0.4

    \[\leadsto \color{blue}{\frac{\frac{1}{x}}{x} - \frac{\frac{1}{x}}{\tan \left(\frac{x}{2}\right)}}\]
  5. Taylor expanded around inf 0.4

    \[\leadsto \color{blue}{\frac{1}{{x}^{2}} - \frac{\cos \left(\frac{1}{2} \cdot x\right)}{x \cdot \sin \left(\frac{1}{2} \cdot x\right)}}\]
  6. Simplified0.4

    \[\leadsto \color{blue}{\frac{\frac{1}{x}}{x} - \frac{\frac{\cos \left(x \cdot \frac{1}{2}\right)}{x}}{\sin \left(x \cdot \frac{1}{2}\right)}}\]
  7. Final simplification0.4

    \[\leadsto \frac{\frac{1}{x}}{x} - \frac{\frac{\cos \left(x \cdot \frac{1}{2}\right)}{x}}{\sin \left(x \cdot \frac{1}{2}\right)}\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "1/x^2*(1-(sin(x)/x)/((1-cos(x))/x^2))"
  (* (/ 1 (pow x 2)) (- 1 (/ (/ (sin x) x) (/ (- 1 (cos x)) (pow x 2))))))