Average Error: 31.9 → 0.0
Time: 10.5s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0268909451166995696:\\ \;\;\;\;\frac{x}{x - \frac{\sin x}{\cos x}} - \frac{\sin x}{x - \frac{\sin x}{\cos x}}\\ \mathbf{elif}\;x \le 0.025959275320095801:\\ \;\;\;\;\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \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.0268909451166995696:\\
\;\;\;\;\frac{x}{x - \frac{\sin x}{\cos x}} - \frac{\sin x}{x - \frac{\sin x}{\cos x}}\\

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

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

\end{array}
double f(double x) {
        double r11767 = x;
        double r11768 = sin(r11767);
        double r11769 = r11767 - r11768;
        double r11770 = tan(r11767);
        double r11771 = r11767 - r11770;
        double r11772 = r11769 / r11771;
        return r11772;
}

double f(double x) {
        double r11773 = x;
        double r11774 = -0.02689094511669957;
        bool r11775 = r11773 <= r11774;
        double r11776 = sin(r11773);
        double r11777 = cos(r11773);
        double r11778 = r11776 / r11777;
        double r11779 = r11773 - r11778;
        double r11780 = r11773 / r11779;
        double r11781 = r11776 / r11779;
        double r11782 = r11780 - r11781;
        double r11783 = 0.0259592753200958;
        bool r11784 = r11773 <= r11783;
        double r11785 = 0.225;
        double r11786 = 2.0;
        double r11787 = pow(r11773, r11786);
        double r11788 = 0.009642857142857142;
        double r11789 = 4.0;
        double r11790 = pow(r11773, r11789);
        double r11791 = 0.5;
        double r11792 = fma(r11788, r11790, r11791);
        double r11793 = -r11792;
        double r11794 = fma(r11785, r11787, r11793);
        double r11795 = r11773 - r11776;
        double r11796 = r11795 / r11779;
        double r11797 = r11784 ? r11794 : r11796;
        double r11798 = r11775 ? r11782 : r11797;
        return r11798;
}

Error

Bits error versus x

Derivation

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

    1. Initial program 0.0

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

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

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

    if -0.02689094511669957 < x < 0.0259592753200958

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

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

    if 0.0259592753200958 < 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. Recombined 3 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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