Average Error: 31.6 → 0.2
Time: 13.7s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02620088919165832960778139693047705804929:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 2.471374940234511541348183527588844299316:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\frac{\sin x}{x \cdot \cos x} + 1\right) + \frac{\sin x}{{x}^{2} \cdot \cos x} \cdot \left(\frac{\sin x}{\cos x} - \sin x\right)\right) - \frac{\sin x}{x}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.02620088919165832960778139693047705804929:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\

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

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

\end{array}
double f(double x) {
        double r8840 = x;
        double r8841 = sin(r8840);
        double r8842 = r8840 - r8841;
        double r8843 = tan(r8840);
        double r8844 = r8840 - r8843;
        double r8845 = r8842 / r8844;
        return r8845;
}

double f(double x) {
        double r8846 = x;
        double r8847 = -0.02620088919165833;
        bool r8848 = r8846 <= r8847;
        double r8849 = sin(r8846);
        double r8850 = r8846 - r8849;
        double r8851 = tan(r8846);
        double r8852 = r8846 - r8851;
        double r8853 = r8850 / r8852;
        double r8854 = 2.4713749402345115;
        bool r8855 = r8846 <= r8854;
        double r8856 = 0.225;
        double r8857 = 2.0;
        double r8858 = pow(r8846, r8857);
        double r8859 = r8856 * r8858;
        double r8860 = 0.009642857142857142;
        double r8861 = 4.0;
        double r8862 = pow(r8846, r8861);
        double r8863 = r8860 * r8862;
        double r8864 = 0.5;
        double r8865 = r8863 + r8864;
        double r8866 = r8859 - r8865;
        double r8867 = cos(r8846);
        double r8868 = r8846 * r8867;
        double r8869 = r8849 / r8868;
        double r8870 = 1.0;
        double r8871 = r8869 + r8870;
        double r8872 = r8858 * r8867;
        double r8873 = r8849 / r8872;
        double r8874 = r8849 / r8867;
        double r8875 = r8874 - r8849;
        double r8876 = r8873 * r8875;
        double r8877 = r8871 + r8876;
        double r8878 = r8849 / r8846;
        double r8879 = r8877 - r8878;
        double r8880 = r8855 ? r8866 : r8879;
        double r8881 = r8848 ? r8853 : r8880;
        return r8881;
}

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.02620088919165833

    1. Initial program 0.0

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

    if -0.02620088919165833 < x < 2.4713749402345115

    1. Initial program 62.8

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

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

    if 2.4713749402345115 < x

    1. Initial program 0.0

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

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

      \[\leadsto \color{blue}{\left(\left(\frac{\sin x}{x \cdot \cos x} + 1\right) + \frac{\sin x}{{x}^{2} \cdot \cos x} \cdot \left(\frac{\sin x}{\cos x} - \sin x\right)\right) - \frac{\sin x}{x}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.2

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

Reproduce

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