Average Error: 31.5 → 0.0
Time: 24.7s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.029332414347062297:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.030132695111622844:\\ \;\;\;\;\left(\frac{9}{40} - \frac{27}{2800} \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\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.029332414347062297:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\

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

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

\end{array}
double f(double x) {
        double r271044 = x;
        double r271045 = sin(r271044);
        double r271046 = r271044 - r271045;
        double r271047 = tan(r271044);
        double r271048 = r271044 - r271047;
        double r271049 = r271046 / r271048;
        return r271049;
}

double f(double x) {
        double r271050 = x;
        double r271051 = -0.029332414347062297;
        bool r271052 = r271050 <= r271051;
        double r271053 = sin(r271050);
        double r271054 = r271050 - r271053;
        double r271055 = tan(r271050);
        double r271056 = r271050 - r271055;
        double r271057 = r271054 / r271056;
        double r271058 = 0.030132695111622844;
        bool r271059 = r271050 <= r271058;
        double r271060 = 0.225;
        double r271061 = 0.009642857142857142;
        double r271062 = r271050 * r271050;
        double r271063 = r271061 * r271062;
        double r271064 = r271060 - r271063;
        double r271065 = r271064 * r271062;
        double r271066 = 0.5;
        double r271067 = r271065 - r271066;
        double r271068 = r271059 ? r271067 : r271057;
        double r271069 = r271052 ? r271057 : r271068;
        return r271069;
}

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.029332414347062297 or 0.030132695111622844 < x

    1. Initial program 0.0

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

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

    if -0.029332414347062297 < x < 0.030132695111622844

    1. Initial program 62.8

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

      \[\leadsto \frac{\color{blue}{x - \sin x}}{x - \tan x}\]
    3. 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)}\]
    4. Simplified0.0

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

Reproduce

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