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

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

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

\end{array}
double f(double x) {
        double r763846 = x;
        double r763847 = sin(r763846);
        double r763848 = r763846 - r763847;
        double r763849 = tan(r763846);
        double r763850 = r763846 - r763849;
        double r763851 = r763848 / r763850;
        return r763851;
}

double f(double x) {
        double r763852 = x;
        double r763853 = -0.027836888459983777;
        bool r763854 = r763852 <= r763853;
        double r763855 = sin(r763852);
        double r763856 = r763852 - r763855;
        double r763857 = tan(r763852);
        double r763858 = r763852 - r763857;
        double r763859 = r763856 / r763858;
        double r763860 = exp(r763859);
        double r763861 = log(r763860);
        double r763862 = 0.02825639784178301;
        bool r763863 = r763852 <= r763862;
        double r763864 = -0.5;
        double r763865 = r763852 * r763852;
        double r763866 = 0.225;
        double r763867 = r763865 * r763866;
        double r763868 = 0.009642857142857142;
        double r763869 = r763865 * r763868;
        double r763870 = r763865 * r763869;
        double r763871 = r763867 - r763870;
        double r763872 = r763864 + r763871;
        double r763873 = r763863 ? r763872 : r763861;
        double r763874 = r763854 ? r763861 : r763873;
        return r763874;
}

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.027836888459983777 or 0.02825639784178301 < x

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-log-exp0.1

      \[\leadsto \color{blue}{\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)}\]

    if -0.027836888459983777 < x < 0.02825639784178301

    1. Initial program 62.8

      \[\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(\frac{9}{40} \cdot \left(x \cdot x\right) - \left(\frac{27}{2800} \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) + \frac{-1}{2}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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