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

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

\end{array}
double f(double x) {
        double r17710 = x;
        double r17711 = sin(r17710);
        double r17712 = r17710 - r17711;
        double r17713 = tan(r17710);
        double r17714 = r17710 - r17713;
        double r17715 = r17712 / r17714;
        return r17715;
}

double f(double x) {
        double r17716 = x;
        double r17717 = -0.02627666216149913;
        bool r17718 = r17716 <= r17717;
        double r17719 = 0.02833570517365807;
        bool r17720 = r17716 <= r17719;
        double r17721 = !r17720;
        bool r17722 = r17718 || r17721;
        double r17723 = sin(r17716);
        double r17724 = r17716 - r17723;
        double r17725 = tan(r17716);
        double r17726 = r17716 - r17725;
        double r17727 = r17724 / r17726;
        double r17728 = 0.225;
        double r17729 = 2.0;
        double r17730 = pow(r17716, r17729);
        double r17731 = 0.009642857142857142;
        double r17732 = 4.0;
        double r17733 = pow(r17716, r17732);
        double r17734 = 0.5;
        double r17735 = fma(r17731, r17733, r17734);
        double r17736 = -r17735;
        double r17737 = fma(r17728, r17730, r17736);
        double r17738 = exp(r17737);
        double r17739 = log(r17738);
        double r17740 = r17722 ? r17727 : r17739;
        return r17740;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.02627666216149913 or 0.02833570517365807 < x

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]

    if -0.02627666216149913 < x < 0.02833570517365807

    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}{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}\]
    4. Using strategy rm
    5. Applied add-log-exp0.0

      \[\leadsto \color{blue}{\log \left(e^{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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