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

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

\end{array}
double f(double x) {
        double r14854 = x;
        double r14855 = sin(r14854);
        double r14856 = r14854 - r14855;
        double r14857 = tan(r14854);
        double r14858 = r14854 - r14857;
        double r14859 = r14856 / r14858;
        return r14859;
}

double f(double x) {
        double r14860 = x;
        double r14861 = -0.02800886827920761;
        bool r14862 = r14860 <= r14861;
        double r14863 = 0.02927114404593424;
        bool r14864 = r14860 <= r14863;
        double r14865 = !r14864;
        bool r14866 = r14862 || r14865;
        double r14867 = sin(r14860);
        double r14868 = r14860 - r14867;
        double r14869 = tan(r14860);
        double r14870 = r14860 - r14869;
        double r14871 = r14868 / r14870;
        double r14872 = 0.225;
        double r14873 = 2.0;
        double r14874 = pow(r14860, r14873);
        double r14875 = r14872 * r14874;
        double r14876 = 0.009642857142857142;
        double r14877 = 4.0;
        double r14878 = pow(r14860, r14877);
        double r14879 = r14876 * r14878;
        double r14880 = 0.5;
        double r14881 = r14879 + r14880;
        double r14882 = r14875 - r14881;
        double r14883 = r14866 ? r14871 : r14882;
        return r14883;
}

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.02800886827920761 or 0.02927114404593424 < x

    1. Initial program 0.0

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

    if -0.02800886827920761 < x < 0.02927114404593424

    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)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.0280088682792076112 \lor \neg \left(x \le 0.029271144045934241\right):\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\\ \end{array}\]

Reproduce

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