Average Error: 29.8 → 0.0
Time: 13.5s
Precision: 64
\[\frac{1 - \cos x}{\sin x}\]
\[\tan \left(\frac{x}{2}\right)\]
\frac{1 - \cos x}{\sin x}
\tan \left(\frac{x}{2}\right)
double f(double x) {
        double r4891049 = 1.0;
        double r4891050 = x;
        double r4891051 = cos(r4891050);
        double r4891052 = r4891049 - r4891051;
        double r4891053 = sin(r4891050);
        double r4891054 = r4891052 / r4891053;
        return r4891054;
}

double f(double x) {
        double r4891055 = x;
        double r4891056 = 2.0;
        double r4891057 = r4891055 / r4891056;
        double r4891058 = tan(r4891057);
        return r4891058;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 29.8

    \[\frac{1 - \cos x}{\sin x}\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\tan \left(\frac{x}{2}\right)}\]
  3. Final simplification0.0

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

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "(1-cos(x))/sin(x)"
  (/ (- 1 (cos x)) (sin x)))