Average Error: 31.7 → 0.0
Time: 10.0s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0290170878265866537 \lor \neg \left(x \le 0.0311971006789354723\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\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.0290170878265866537 \lor \neg \left(x \le 0.0311971006789354723\right):\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\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 r11280 = x;
        double r11281 = sin(r11280);
        double r11282 = r11280 - r11281;
        double r11283 = tan(r11280);
        double r11284 = r11280 - r11283;
        double r11285 = r11282 / r11284;
        return r11285;
}

double f(double x) {
        double r11286 = x;
        double r11287 = -0.029017087826586654;
        bool r11288 = r11286 <= r11287;
        double r11289 = 0.031197100678935472;
        bool r11290 = r11286 <= r11289;
        double r11291 = !r11290;
        bool r11292 = r11288 || r11291;
        double r11293 = tan(r11286);
        double r11294 = r11286 - r11293;
        double r11295 = r11286 / r11294;
        double r11296 = sin(r11286);
        double r11297 = r11296 / r11294;
        double r11298 = r11295 - r11297;
        double r11299 = 0.225;
        double r11300 = 2.0;
        double r11301 = pow(r11286, r11300);
        double r11302 = r11299 * r11301;
        double r11303 = 0.009642857142857142;
        double r11304 = 4.0;
        double r11305 = pow(r11286, r11304);
        double r11306 = r11303 * r11305;
        double r11307 = 0.5;
        double r11308 = r11306 + r11307;
        double r11309 = r11302 - r11308;
        double r11310 = r11292 ? r11298 : r11309;
        return r11310;
}

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.029017087826586654 or 0.031197100678935472 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub0.0

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

    if -0.029017087826586654 < x < 0.031197100678935472

    1. Initial program 63.2

      \[\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.0290170878265866537 \lor \neg \left(x \le 0.0311971006789354723\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\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 2020083 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))