Average Error: 30.9 → 0.4
Time: 36.6s
Precision: 64
\[\frac{1 - \cos x}{x \cdot x}\]
\[\frac{\frac{\sin x}{x} \cdot \frac{\sin x}{x}}{\log \left(e^{\cos x} \cdot e\right)}\]
\frac{1 - \cos x}{x \cdot x}
\frac{\frac{\sin x}{x} \cdot \frac{\sin x}{x}}{\log \left(e^{\cos x} \cdot e\right)}
double f(double x) {
        double r2039337 = 1.0;
        double r2039338 = x;
        double r2039339 = cos(r2039338);
        double r2039340 = r2039337 - r2039339;
        double r2039341 = r2039338 * r2039338;
        double r2039342 = r2039340 / r2039341;
        return r2039342;
}

double f(double x) {
        double r2039343 = x;
        double r2039344 = sin(r2039343);
        double r2039345 = r2039344 / r2039343;
        double r2039346 = r2039345 * r2039345;
        double r2039347 = cos(r2039343);
        double r2039348 = exp(r2039347);
        double r2039349 = exp(1.0);
        double r2039350 = r2039348 * r2039349;
        double r2039351 = log(r2039350);
        double r2039352 = r2039346 / r2039351;
        return r2039352;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 30.9

    \[\frac{1 - \cos x}{x \cdot x}\]
  2. Using strategy rm
  3. Applied flip--31.1

    \[\leadsto \frac{\color{blue}{\frac{1 \cdot 1 - \cos x \cdot \cos x}{1 + \cos x}}}{x \cdot x}\]
  4. Applied associate-/l/31.1

    \[\leadsto \color{blue}{\frac{1 \cdot 1 - \cos x \cdot \cos x}{\left(x \cdot x\right) \cdot \left(1 + \cos x\right)}}\]
  5. Simplified15.4

    \[\leadsto \frac{\color{blue}{\sin x \cdot \sin x}}{\left(x \cdot x\right) \cdot \left(1 + \cos x\right)}\]
  6. Taylor expanded around inf 15.4

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

    \[\leadsto \color{blue}{\frac{\frac{\sin x}{x} \cdot \frac{\sin x}{x}}{\cos x + 1}}\]
  8. Using strategy rm
  9. Applied add-log-exp0.3

    \[\leadsto \frac{\frac{\sin x}{x} \cdot \frac{\sin x}{x}}{\cos x + \color{blue}{\log \left(e^{1}\right)}}\]
  10. Applied add-log-exp0.3

    \[\leadsto \frac{\frac{\sin x}{x} \cdot \frac{\sin x}{x}}{\color{blue}{\log \left(e^{\cos x}\right)} + \log \left(e^{1}\right)}\]
  11. Applied sum-log0.4

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

    \[\leadsto \frac{\frac{\sin x}{x} \cdot \frac{\sin x}{x}}{\log \color{blue}{\left(e^{\cos x} \cdot e\right)}}\]
  13. Final simplification0.4

    \[\leadsto \frac{\frac{\sin x}{x} \cdot \frac{\sin x}{x}}{\log \left(e^{\cos x} \cdot e\right)}\]

Reproduce

herbie shell --seed 2019119 
(FPCore (x)
  :name "cos2 (problem 3.4.1)"
  (/ (- 1 (cos x)) (* x x)))