Average Error: 31.6 → 0.0
Time: 16.8s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02620088919165832960778139693047705804929:\\ \;\;\;\;\frac{x - \sin x}{x - \frac{\sin x}{\cos x}}\\ \mathbf{elif}\;x \le 0.02652408205241486155445684858023014385253:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \frac{\sin x}{\cos x}} - \frac{\sin x}{x - \frac{\sin x}{\cos x}}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.02620088919165832960778139693047705804929:\\
\;\;\;\;\frac{x - \sin x}{x - \frac{\sin x}{\cos x}}\\

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

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

\end{array}
double f(double x) {
        double r18689 = x;
        double r18690 = sin(r18689);
        double r18691 = r18689 - r18690;
        double r18692 = tan(r18689);
        double r18693 = r18689 - r18692;
        double r18694 = r18691 / r18693;
        return r18694;
}

double f(double x) {
        double r18695 = x;
        double r18696 = -0.02620088919165833;
        bool r18697 = r18695 <= r18696;
        double r18698 = sin(r18695);
        double r18699 = r18695 - r18698;
        double r18700 = cos(r18695);
        double r18701 = r18698 / r18700;
        double r18702 = r18695 - r18701;
        double r18703 = r18699 / r18702;
        double r18704 = 0.02652408205241486;
        bool r18705 = r18695 <= r18704;
        double r18706 = 0.225;
        double r18707 = 2.0;
        double r18708 = pow(r18695, r18707);
        double r18709 = r18706 * r18708;
        double r18710 = 0.009642857142857142;
        double r18711 = 4.0;
        double r18712 = pow(r18695, r18711);
        double r18713 = 0.5;
        double r18714 = fma(r18710, r18712, r18713);
        double r18715 = r18709 - r18714;
        double r18716 = r18695 / r18702;
        double r18717 = r18698 / r18702;
        double r18718 = r18716 - r18717;
        double r18719 = r18705 ? r18715 : r18718;
        double r18720 = r18697 ? r18703 : r18719;
        return r18720;
}

Error

Bits error versus x

Derivation

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

    1. Initial program 0.0

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

    if -0.02620088919165833 < x < 0.02652408205241486

    1. Initial program 63.1

      \[\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. Simplified0.0

      \[\leadsto \color{blue}{\frac{9}{40} \cdot {x}^{2} - \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\]

    if 0.02652408205241486 < 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-sub0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.02620088919165832960778139693047705804929:\\ \;\;\;\;\frac{x - \sin x}{x - \frac{\sin x}{\cos x}}\\ \mathbf{elif}\;x \le 0.02652408205241486155445684858023014385253:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \frac{\sin x}{\cos x}} - \frac{\sin x}{x - \frac{\sin x}{\cos x}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019351 +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))