Average Error: 30.6 → 0.1
Time: 30.4s
Precision: 64
\[\frac{1 - \cos x}{{x}^{2}}\]
\[\frac{\sin x}{x} \cdot \frac{\tan \left(\frac{x}{2}\right)}{x}\]
\frac{1 - \cos x}{{x}^{2}}
\frac{\sin x}{x} \cdot \frac{\tan \left(\frac{x}{2}\right)}{x}
double f(double x) {
        double r13321633 = 1.0;
        double r13321634 = x;
        double r13321635 = cos(r13321634);
        double r13321636 = r13321633 - r13321635;
        double r13321637 = 2.0;
        double r13321638 = pow(r13321634, r13321637);
        double r13321639 = r13321636 / r13321638;
        return r13321639;
}

double f(double x) {
        double r13321640 = x;
        double r13321641 = sin(r13321640);
        double r13321642 = r13321641 / r13321640;
        double r13321643 = 2.0;
        double r13321644 = r13321640 / r13321643;
        double r13321645 = tan(r13321644);
        double r13321646 = r13321645 / r13321640;
        double r13321647 = r13321642 * r13321646;
        return r13321647;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 30.6

    \[\frac{1 - \cos x}{{x}^{2}}\]
  2. Simplified30.6

    \[\leadsto \color{blue}{\frac{1 - \cos x}{x \cdot x}}\]
  3. Using strategy rm
  4. Applied flip--30.8

    \[\leadsto \frac{\color{blue}{\frac{1 \cdot 1 - \cos x \cdot \cos x}{1 + \cos x}}}{x \cdot x}\]
  5. Simplified15.3

    \[\leadsto \frac{\frac{\color{blue}{\sin x \cdot \sin x}}{1 + \cos x}}{x \cdot x}\]
  6. Using strategy rm
  7. Applied *-un-lft-identity15.3

    \[\leadsto \frac{\frac{\sin x \cdot \sin x}{1 + \color{blue}{1 \cdot \cos x}}}{x \cdot x}\]
  8. Applied *-un-lft-identity15.3

    \[\leadsto \frac{\frac{\sin x \cdot \sin x}{\color{blue}{1 \cdot 1} + 1 \cdot \cos x}}{x \cdot x}\]
  9. Applied distribute-lft-out15.3

    \[\leadsto \frac{\frac{\sin x \cdot \sin x}{\color{blue}{1 \cdot \left(1 + \cos x\right)}}}{x \cdot x}\]
  10. Applied times-frac15.3

    \[\leadsto \frac{\color{blue}{\frac{\sin x}{1} \cdot \frac{\sin x}{1 + \cos x}}}{x \cdot x}\]
  11. Applied times-frac0.3

    \[\leadsto \color{blue}{\frac{\frac{\sin x}{1}}{x} \cdot \frac{\frac{\sin x}{1 + \cos x}}{x}}\]
  12. Simplified0.3

    \[\leadsto \color{blue}{\frac{\sin x}{x}} \cdot \frac{\frac{\sin x}{1 + \cos x}}{x}\]
  13. Simplified0.1

    \[\leadsto \frac{\sin x}{x} \cdot \color{blue}{\frac{\tan \left(\frac{x}{2}\right)}{x}}\]
  14. Final simplification0.1

    \[\leadsto \frac{\sin x}{x} \cdot \frac{\tan \left(\frac{x}{2}\right)}{x}\]

Reproduce

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