Average Error: 31.9 → 0.0
Time: 9.3s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.024784357953886 \lor \neg \left(x \le 0.027692563310526046\right):\\ \;\;\;\;\frac{x - \sin x}{x - \sin x \cdot \frac{1}{\cos 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.024784357953886 \lor \neg \left(x \le 0.027692563310526046\right):\\
\;\;\;\;\frac{x - \sin x}{x - \sin x \cdot \frac{1}{\cos 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 r9783 = x;
        double r9784 = sin(r9783);
        double r9785 = r9783 - r9784;
        double r9786 = tan(r9783);
        double r9787 = r9783 - r9786;
        double r9788 = r9785 / r9787;
        return r9788;
}

double f(double x) {
        double r9789 = x;
        double r9790 = -0.024784357953886005;
        bool r9791 = r9789 <= r9790;
        double r9792 = 0.027692563310526046;
        bool r9793 = r9789 <= r9792;
        double r9794 = !r9793;
        bool r9795 = r9791 || r9794;
        double r9796 = sin(r9789);
        double r9797 = r9789 - r9796;
        double r9798 = 1.0;
        double r9799 = cos(r9789);
        double r9800 = r9798 / r9799;
        double r9801 = r9796 * r9800;
        double r9802 = r9789 - r9801;
        double r9803 = r9797 / r9802;
        double r9804 = 0.225;
        double r9805 = 2.0;
        double r9806 = pow(r9789, r9805);
        double r9807 = r9804 * r9806;
        double r9808 = 0.009642857142857142;
        double r9809 = 4.0;
        double r9810 = pow(r9789, r9809);
        double r9811 = r9808 * r9810;
        double r9812 = 0.5;
        double r9813 = r9811 + r9812;
        double r9814 = r9807 - r9813;
        double r9815 = r9795 ? r9803 : r9814;
        return r9815;
}

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.024784357953886005 or 0.027692563310526046 < x

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around inf 0.1

      \[\leadsto \frac{x - \sin x}{\color{blue}{x - \frac{\sin x}{\cos x}}}\]
    3. Using strategy rm
    4. Applied div-inv0.1

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

    if -0.024784357953886005 < x < 0.027692563310526046

    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.024784357953886 \lor \neg \left(x \le 0.027692563310526046\right):\\ \;\;\;\;\frac{x - \sin x}{x - \sin x \cdot \frac{1}{\cos 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 2020059 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))