Average Error: 31.7 → 0.0
Time: 10.3s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.03151178590185569478032689971769286785275:\\ \;\;\;\;\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\frac{\sin x}{x - \tan x} \cdot \left(\frac{\sin x}{x - \frac{\sin x}{\cos x}} + \frac{x}{x - \tan x}\right) + \frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x}}\\ \mathbf{elif}\;x \le 0.06543863896081261732895484328764723613858:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \log \left(e^{\frac{\sin x}{x - \tan x}}\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.03151178590185569478032689971769286785275:\\
\;\;\;\;\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\frac{\sin x}{x - \tan x} \cdot \left(\frac{\sin x}{x - \frac{\sin x}{\cos x}} + \frac{x}{x - \tan x}\right) + \frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x}}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{x}{x - \tan x} - \log \left(e^{\frac{\sin x}{x - \tan x}}\right)\\

\end{array}
double f(double x) {
        double r14871 = x;
        double r14872 = sin(r14871);
        double r14873 = r14871 - r14872;
        double r14874 = tan(r14871);
        double r14875 = r14871 - r14874;
        double r14876 = r14873 / r14875;
        return r14876;
}

double f(double x) {
        double r14877 = x;
        double r14878 = -0.031511785901855695;
        bool r14879 = r14877 <= r14878;
        double r14880 = tan(r14877);
        double r14881 = r14877 - r14880;
        double r14882 = r14877 / r14881;
        double r14883 = 3.0;
        double r14884 = pow(r14882, r14883);
        double r14885 = sin(r14877);
        double r14886 = r14885 / r14881;
        double r14887 = pow(r14886, r14883);
        double r14888 = r14884 - r14887;
        double r14889 = cos(r14877);
        double r14890 = r14885 / r14889;
        double r14891 = r14877 - r14890;
        double r14892 = r14885 / r14891;
        double r14893 = r14892 + r14882;
        double r14894 = r14886 * r14893;
        double r14895 = r14882 * r14882;
        double r14896 = r14894 + r14895;
        double r14897 = r14888 / r14896;
        double r14898 = 0.06543863896081262;
        bool r14899 = r14877 <= r14898;
        double r14900 = 0.225;
        double r14901 = 2.0;
        double r14902 = pow(r14877, r14901);
        double r14903 = r14900 * r14902;
        double r14904 = 0.009642857142857142;
        double r14905 = 4.0;
        double r14906 = pow(r14877, r14905);
        double r14907 = r14904 * r14906;
        double r14908 = 0.5;
        double r14909 = r14907 + r14908;
        double r14910 = r14903 - r14909;
        double r14911 = exp(r14886);
        double r14912 = log(r14911);
        double r14913 = r14882 - r14912;
        double r14914 = r14899 ? r14910 : r14913;
        double r14915 = r14879 ? r14897 : r14914;
        return r14915;
}

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

    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}}\]
    4. Using strategy rm
    5. Applied flip3--0.0

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \left(\frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x} + \frac{x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x}\right)}}\]
    6. Simplified0.0

      \[\leadsto \frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\color{blue}{\frac{\sin x}{x - \tan x} \cdot \left(\frac{\sin x}{x - \tan x} + \frac{x}{x - \tan x}\right) + \frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x}}}\]
    7. Taylor expanded around inf 0.0

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

    if -0.031511785901855695 < x < 0.06543863896081262

    1. Initial program 63.0

      \[\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.06543863896081262 < 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}}\]
    4. Using strategy rm
    5. Applied add-log-exp0.0

      \[\leadsto \frac{x}{x - \tan x} - \color{blue}{\log \left(e^{\frac{\sin x}{x - \tan x}}\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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