Average Error: 31.2 → 0.0
Time: 26.1s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02767094041582889:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.0350085026921760009:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.02767094041582889:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

\end{array}
double f(double x) {
        double r17846 = x;
        double r17847 = sin(r17846);
        double r17848 = r17846 - r17847;
        double r17849 = tan(r17846);
        double r17850 = r17846 - r17849;
        double r17851 = r17848 / r17850;
        return r17851;
}

double f(double x) {
        double r17852 = x;
        double r17853 = -0.02767094041582889;
        bool r17854 = r17852 <= r17853;
        double r17855 = sin(r17852);
        double r17856 = r17852 - r17855;
        double r17857 = tan(r17852);
        double r17858 = r17852 - r17857;
        double r17859 = r17856 / r17858;
        double r17860 = 0.035008502692176;
        bool r17861 = r17852 <= r17860;
        double r17862 = 0.225;
        double r17863 = 2.0;
        double r17864 = pow(r17852, r17863);
        double r17865 = r17862 * r17864;
        double r17866 = 0.009642857142857142;
        double r17867 = 4.0;
        double r17868 = pow(r17852, r17867);
        double r17869 = r17866 * r17868;
        double r17870 = 0.5;
        double r17871 = r17869 + r17870;
        double r17872 = r17865 - r17871;
        double r17873 = r17852 / r17858;
        double r17874 = r17855 / r17858;
        double r17875 = r17873 - r17874;
        double r17876 = r17861 ? r17872 : r17875;
        double r17877 = r17854 ? r17859 : r17876;
        return r17877;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if x < -0.02767094041582889

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]

    if -0.02767094041582889 < x < 0.035008502692176

    1. Initial program 63.4

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

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

    if 0.035008502692176 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub0.0

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.02767094041582889:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.0350085026921760009:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \end{array}\]

Reproduce

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