Average Error: 30.6 → 0.3
Time: 27.9s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.508948866519329:\\ \;\;\;\;\left(\frac{\sin x}{\cos x \cdot x} \cdot \frac{\sin x}{\cos x \cdot x} + 1\right) + \log \left(e^{\frac{\sin x}{\cos x \cdot x} - \left(\frac{\frac{\sin x}{x} \cdot \frac{\sin x}{x}}{\cos x} + \frac{\sin x}{x}\right)}\right)\\ \mathbf{elif}\;x \le 2.4203399319729506:\\ \;\;\;\;\left(\frac{9}{40} - \frac{27}{2800} \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) - \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sin x}{\cos x \cdot x} \cdot \frac{\sin x}{\cos x \cdot x} + 1\right) + \log \left(e^{\frac{\sin x}{\cos x \cdot x} - \left(\frac{\frac{\sin x}{x} \cdot \frac{\sin x}{x}}{\cos x} + \frac{\sin x}{x}\right)}\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -2.508948866519329:\\
\;\;\;\;\left(\frac{\sin x}{\cos x \cdot x} \cdot \frac{\sin x}{\cos x \cdot x} + 1\right) + \log \left(e^{\frac{\sin x}{\cos x \cdot x} - \left(\frac{\frac{\sin x}{x} \cdot \frac{\sin x}{x}}{\cos x} + \frac{\sin x}{x}\right)}\right)\\

\mathbf{elif}\;x \le 2.4203399319729506:\\
\;\;\;\;\left(\frac{9}{40} - \frac{27}{2800} \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) - \frac{1}{2}\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{\sin x}{\cos x \cdot x} \cdot \frac{\sin x}{\cos x \cdot x} + 1\right) + \log \left(e^{\frac{\sin x}{\cos x \cdot x} - \left(\frac{\frac{\sin x}{x} \cdot \frac{\sin x}{x}}{\cos x} + \frac{\sin x}{x}\right)}\right)\\

\end{array}
double f(double x) {
        double r883339 = x;
        double r883340 = sin(r883339);
        double r883341 = r883339 - r883340;
        double r883342 = tan(r883339);
        double r883343 = r883339 - r883342;
        double r883344 = r883341 / r883343;
        return r883344;
}

double f(double x) {
        double r883345 = x;
        double r883346 = -2.508948866519329;
        bool r883347 = r883345 <= r883346;
        double r883348 = sin(r883345);
        double r883349 = cos(r883345);
        double r883350 = r883349 * r883345;
        double r883351 = r883348 / r883350;
        double r883352 = r883351 * r883351;
        double r883353 = 1.0;
        double r883354 = r883352 + r883353;
        double r883355 = r883348 / r883345;
        double r883356 = r883355 * r883355;
        double r883357 = r883356 / r883349;
        double r883358 = r883357 + r883355;
        double r883359 = r883351 - r883358;
        double r883360 = exp(r883359);
        double r883361 = log(r883360);
        double r883362 = r883354 + r883361;
        double r883363 = 2.4203399319729506;
        bool r883364 = r883345 <= r883363;
        double r883365 = 0.225;
        double r883366 = 0.009642857142857142;
        double r883367 = r883345 * r883345;
        double r883368 = r883366 * r883367;
        double r883369 = r883365 - r883368;
        double r883370 = r883369 * r883367;
        double r883371 = 0.5;
        double r883372 = r883370 - r883371;
        double r883373 = r883364 ? r883372 : r883362;
        double r883374 = r883347 ? r883362 : r883373;
        return r883374;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -2.508948866519329 or 2.4203399319729506 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around inf 0.3

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

      \[\leadsto \color{blue}{\left(\frac{\sin x}{x \cdot \cos x} \cdot \frac{\sin x}{x \cdot \cos x} + 1\right) + \left(\frac{\sin x}{x \cdot \cos x} - \left(\frac{\frac{\sin x}{x} \cdot \frac{\sin x}{x}}{\cos x} + \frac{\sin x}{x}\right)\right)}\]
    4. Using strategy rm
    5. Applied add-log-exp0.3

      \[\leadsto \left(\frac{\sin x}{x \cdot \cos x} \cdot \frac{\sin x}{x \cdot \cos x} + 1\right) + \color{blue}{\log \left(e^{\frac{\sin x}{x \cdot \cos x} - \left(\frac{\frac{\sin x}{x} \cdot \frac{\sin x}{x}}{\cos x} + \frac{\sin x}{x}\right)}\right)}\]

    if -2.508948866519329 < x < 2.4203399319729506

    1. Initial program 62.2

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around 0 0.3

      \[\leadsto \color{blue}{\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}\]
    3. Simplified0.3

      \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \left(\frac{9}{40} - \left(x \cdot x\right) \cdot \frac{27}{2800}\right) - \frac{1}{2}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -2.508948866519329:\\ \;\;\;\;\left(\frac{\sin x}{\cos x \cdot x} \cdot \frac{\sin x}{\cos x \cdot x} + 1\right) + \log \left(e^{\frac{\sin x}{\cos x \cdot x} - \left(\frac{\frac{\sin x}{x} \cdot \frac{\sin x}{x}}{\cos x} + \frac{\sin x}{x}\right)}\right)\\ \mathbf{elif}\;x \le 2.4203399319729506:\\ \;\;\;\;\left(\frac{9}{40} - \frac{27}{2800} \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) - \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sin x}{\cos x \cdot x} \cdot \frac{\sin x}{\cos x \cdot x} + 1\right) + \log \left(e^{\frac{\sin x}{\cos x \cdot x} - \left(\frac{\frac{\sin x}{x} \cdot \frac{\sin x}{x}}{\cos x} + \frac{\sin x}{x}\right)}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019165 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  (/ (- x (sin x)) (- x (tan x))))