Average Error: 31.3 → 0.0
Time: 13.5s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0275654979361482401 \lor \neg \left(x \le 0.029125046562482146\right):\\ \;\;\;\;\frac{1}{\frac{x - \tan x}{x - \sin x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.0275654979361482401 \lor \neg \left(x \le 0.029125046562482146\right):\\
\;\;\;\;\frac{1}{\frac{x - \tan x}{x - \sin x}}\\

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

\end{array}
double f(double x) {
        double r13744 = x;
        double r13745 = sin(r13744);
        double r13746 = r13744 - r13745;
        double r13747 = tan(r13744);
        double r13748 = r13744 - r13747;
        double r13749 = r13746 / r13748;
        return r13749;
}

double f(double x) {
        double r13750 = x;
        double r13751 = -0.02756549793614824;
        bool r13752 = r13750 <= r13751;
        double r13753 = 0.029125046562482146;
        bool r13754 = r13750 <= r13753;
        double r13755 = !r13754;
        bool r13756 = r13752 || r13755;
        double r13757 = 1.0;
        double r13758 = tan(r13750);
        double r13759 = r13750 - r13758;
        double r13760 = sin(r13750);
        double r13761 = r13750 - r13760;
        double r13762 = r13759 / r13761;
        double r13763 = r13757 / r13762;
        double r13764 = 0.225;
        double r13765 = 2.0;
        double r13766 = pow(r13750, r13765);
        double r13767 = r13764 * r13766;
        double r13768 = 0.009642857142857142;
        double r13769 = 4.0;
        double r13770 = pow(r13750, r13769);
        double r13771 = 0.5;
        double r13772 = fma(r13768, r13770, r13771);
        double r13773 = r13767 - r13772;
        double r13774 = r13756 ? r13763 : r13773;
        return r13774;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.02756549793614824 or 0.029125046562482146 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied clear-num0.1

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

    if -0.02756549793614824 < x < 0.029125046562482146

    1. Initial program 63.0

      \[\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)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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