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

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

\mathbf{else}:\\
\;\;\;\;1 \cdot \left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right)\\

\end{array}
double f(double x) {
        double r11822 = x;
        double r11823 = sin(r11822);
        double r11824 = r11822 - r11823;
        double r11825 = tan(r11822);
        double r11826 = r11822 - r11825;
        double r11827 = r11824 / r11826;
        return r11827;
}

double f(double x) {
        double r11828 = x;
        double r11829 = -0.0237917079813031;
        bool r11830 = r11828 <= r11829;
        double r11831 = 1.0;
        double r11832 = sin(r11828);
        double r11833 = r11828 - r11832;
        double r11834 = tan(r11828);
        double r11835 = r11828 - r11834;
        double r11836 = r11833 / r11835;
        double r11837 = r11831 * r11836;
        double r11838 = 0.030711477964933176;
        bool r11839 = r11828 <= r11838;
        double r11840 = 0.225;
        double r11841 = 2.0;
        double r11842 = pow(r11828, r11841);
        double r11843 = r11840 * r11842;
        double r11844 = 0.009642857142857142;
        double r11845 = 4.0;
        double r11846 = pow(r11828, r11845);
        double r11847 = r11844 * r11846;
        double r11848 = 0.5;
        double r11849 = r11847 + r11848;
        double r11850 = r11843 - r11849;
        double r11851 = r11828 / r11835;
        double r11852 = r11832 / r11835;
        double r11853 = r11851 - r11852;
        double r11854 = r11831 * r11853;
        double r11855 = r11839 ? r11850 : r11854;
        double r11856 = r11830 ? r11837 : r11855;
        return r11856;
}

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

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity0.1

      \[\leadsto \frac{x - \sin x}{\color{blue}{1 \cdot \left(x - \tan x\right)}}\]
    4. Applied *-un-lft-identity0.1

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x - \sin x\right)}}{1 \cdot \left(x - \tan x\right)}\]
    5. Applied times-frac0.1

      \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{x - \sin x}{x - \tan x}}\]
    6. Simplified0.1

      \[\leadsto \color{blue}{1} \cdot \frac{x - \sin x}{x - \tan x}\]

    if -0.0237917079813031 < x < 0.030711477964933176

    1. Initial program 63.3

      \[\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.030711477964933176 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity0.0

      \[\leadsto \frac{x - \sin x}{\color{blue}{1 \cdot \left(x - \tan x\right)}}\]
    4. Applied *-un-lft-identity0.0

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x - \sin x\right)}}{1 \cdot \left(x - \tan x\right)}\]
    5. Applied times-frac0.0

      \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{x - \sin x}{x - \tan x}}\]
    6. Simplified0.0

      \[\leadsto \color{blue}{1} \cdot \frac{x - \sin x}{x - \tan x}\]
    7. Using strategy rm
    8. Applied div-sub0.0

      \[\leadsto 1 \cdot \color{blue}{\left(\frac{x}{x - \tan x} - \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.02379170798130310002238552158360107569024:\\ \;\;\;\;1 \cdot \frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.03071147796493317594368477330135647207499:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right)\\ \end{array}\]

Reproduce

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