Average Error: 32.1 → 0.0
Time: 9.8s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02951458613282759504969909869487310061231:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.02672696280496188875330787482198502402753:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\\ \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.02951458613282759504969909869487310061231:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

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

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

\end{array}
double f(double x) {
        double r11482 = x;
        double r11483 = sin(r11482);
        double r11484 = r11482 - r11483;
        double r11485 = tan(r11482);
        double r11486 = r11482 - r11485;
        double r11487 = r11484 / r11486;
        return r11487;
}

double f(double x) {
        double r11488 = x;
        double r11489 = -0.029514586132827595;
        bool r11490 = r11488 <= r11489;
        double r11491 = tan(r11488);
        double r11492 = r11488 - r11491;
        double r11493 = r11488 / r11492;
        double r11494 = sin(r11488);
        double r11495 = r11494 / r11492;
        double r11496 = r11493 - r11495;
        double r11497 = 0.02672696280496189;
        bool r11498 = r11488 <= r11497;
        double r11499 = 0.225;
        double r11500 = 2.0;
        double r11501 = pow(r11488, r11500);
        double r11502 = r11499 * r11501;
        double r11503 = 0.009642857142857142;
        double r11504 = 4.0;
        double r11505 = pow(r11488, r11504);
        double r11506 = r11503 * r11505;
        double r11507 = 0.5;
        double r11508 = r11506 + r11507;
        double r11509 = r11502 - r11508;
        double r11510 = r11488 - r11494;
        double r11511 = r11510 / r11492;
        double r11512 = r11498 ? r11509 : r11511;
        double r11513 = r11490 ? r11496 : r11512;
        return r11513;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if x < -0.029514586132827595

    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.029514586132827595 < x < 0.02672696280496189

    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)}\]

    if 0.02672696280496189 < 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}}\]
    4. Using strategy rm
    5. Applied sub-div0.0

      \[\leadsto \color{blue}{\frac{x - \sin x}{x - \tan x}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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