Average Error: 32.3 → 0.0
Time: 23.5s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02728295921929062631261508897750900359824:\\ \;\;\;\;\frac{\frac{x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x}\right) - \frac{\sin x}{x - \tan x} \cdot \left(\frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x}\right)}{\left(\frac{\sin x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{\frac{x \cdot x - \tan x \cdot \tan x}{\tan x + x}}\right) + \frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x}}\\ \mathbf{elif}\;x \le 0.02889589578744286221811954362692631548271:\\ \;\;\;\;\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}:\\ \;\;\;\;\frac{\frac{x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x}\right) - \frac{\sin x}{x - \tan x} \cdot \left(\frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x}\right)}{\left(\frac{\sin x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{\frac{x \cdot x - \tan x \cdot \tan x}{\tan x + x}}\right) + \frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x}}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.02728295921929062631261508897750900359824:\\
\;\;\;\;\frac{\frac{x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x}\right) - \frac{\sin x}{x - \tan x} \cdot \left(\frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x}\right)}{\left(\frac{\sin x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{\frac{x \cdot x - \tan x \cdot \tan x}{\tan x + x}}\right) + \frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x}}\\

\mathbf{elif}\;x \le 0.02889589578744286221811954362692631548271:\\
\;\;\;\;\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}:\\
\;\;\;\;\frac{\frac{x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x}\right) - \frac{\sin x}{x - \tan x} \cdot \left(\frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x}\right)}{\left(\frac{\sin x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{\frac{x \cdot x - \tan x \cdot \tan x}{\tan x + x}}\right) + \frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x}}\\

\end{array}
double f(double x) {
        double r842852 = x;
        double r842853 = sin(r842852);
        double r842854 = r842852 - r842853;
        double r842855 = tan(r842852);
        double r842856 = r842852 - r842855;
        double r842857 = r842854 / r842856;
        return r842857;
}

double f(double x) {
        double r842858 = x;
        double r842859 = -0.027282959219290626;
        bool r842860 = r842858 <= r842859;
        double r842861 = tan(r842858);
        double r842862 = r842858 - r842861;
        double r842863 = r842858 / r842862;
        double r842864 = r842863 * r842863;
        double r842865 = r842863 * r842864;
        double r842866 = sin(r842858);
        double r842867 = r842866 / r842862;
        double r842868 = r842867 * r842867;
        double r842869 = r842867 * r842868;
        double r842870 = r842865 - r842869;
        double r842871 = r842867 * r842863;
        double r842872 = r842858 * r842858;
        double r842873 = r842861 * r842861;
        double r842874 = r842872 - r842873;
        double r842875 = r842861 + r842858;
        double r842876 = r842874 / r842875;
        double r842877 = r842866 / r842876;
        double r842878 = r842867 * r842877;
        double r842879 = r842871 + r842878;
        double r842880 = r842879 + r842864;
        double r842881 = r842870 / r842880;
        double r842882 = 0.028895895787442862;
        bool r842883 = r842858 <= r842882;
        double r842884 = 0.225;
        double r842885 = 0.009642857142857142;
        double r842886 = r842885 * r842872;
        double r842887 = r842884 - r842886;
        double r842888 = r842887 * r842872;
        double r842889 = 0.5;
        double r842890 = r842888 - r842889;
        double r842891 = r842883 ? r842890 : r842881;
        double r842892 = r842860 ? r842881 : r842891;
        return r842892;
}

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 < -0.027282959219290626 or 0.028895895787442862 < x

    1. Initial program 0.0

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

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
    4. Using strategy rm
    5. Applied flip3--0.1

      \[\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.1

      \[\leadsto \frac{\color{blue}{\left(\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x}\right) \cdot \frac{x}{x - \tan x} - \left(\frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x}\right) \cdot \frac{\sin x}{x - \tan x}}}{\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)}\]
    7. Using strategy rm
    8. Applied flip--0.1

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

    if -0.027282959219290626 < x < 0.028895895787442862

    1. Initial program 63.2

      \[\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)}\]
    3. Simplified0.0

      \[\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.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.02728295921929062631261508897750900359824:\\ \;\;\;\;\frac{\frac{x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x}\right) - \frac{\sin x}{x - \tan x} \cdot \left(\frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x}\right)}{\left(\frac{\sin x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{\frac{x \cdot x - \tan x \cdot \tan x}{\tan x + x}}\right) + \frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x}}\\ \mathbf{elif}\;x \le 0.02889589578744286221811954362692631548271:\\ \;\;\;\;\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}:\\ \;\;\;\;\frac{\frac{x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x}\right) - \frac{\sin x}{x - \tan x} \cdot \left(\frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x}\right)}{\left(\frac{\sin x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{\frac{x \cdot x - \tan x \cdot \tan x}{\tan x + x}}\right) + \frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x}}\\ \end{array}\]

Reproduce

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