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

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

\mathbf{else}:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\

\end{array}
double f(double x) {
        double r327921 = x;
        double r327922 = sin(r327921);
        double r327923 = r327921 - r327922;
        double r327924 = tan(r327921);
        double r327925 = r327921 - r327924;
        double r327926 = r327923 / r327925;
        return r327926;
}

double f(double x) {
        double r327927 = x;
        double r327928 = -0.026698176511519112;
        bool r327929 = r327927 <= r327928;
        double r327930 = sin(r327927);
        double r327931 = r327927 - r327930;
        double r327932 = tan(r327927);
        double r327933 = r327927 - r327932;
        double r327934 = r327931 / r327933;
        double r327935 = 0.030284261983213122;
        bool r327936 = r327927 <= r327935;
        double r327937 = r327927 * r327927;
        double r327938 = 0.225;
        double r327939 = r327937 * r327938;
        double r327940 = 0.009642857142857142;
        double r327941 = r327937 * r327937;
        double r327942 = r327940 * r327941;
        double r327943 = r327939 - r327942;
        double r327944 = 0.5;
        double r327945 = r327943 - r327944;
        double r327946 = r327936 ? r327945 : r327934;
        double r327947 = r327929 ? r327934 : r327946;
        return r327947;
}

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.026698176511519112 or 0.030284261983213122 < x

    1. Initial program 0.0

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

    if -0.026698176511519112 < x < 0.030284261983213122

    1. Initial program 62.6

      \[\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(\left(x \cdot x\right) \cdot \frac{9}{40} - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\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.026698176511519112:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.030284261983213122:\\ \;\;\;\;\left(\left(x \cdot x\right) \cdot \frac{9}{40} - \frac{27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) - \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \end{array}\]

Reproduce

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