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

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

\end{array}
double f(double x) {
        double r14134 = x;
        double r14135 = sin(r14134);
        double r14136 = r14134 - r14135;
        double r14137 = tan(r14134);
        double r14138 = r14134 - r14137;
        double r14139 = r14136 / r14138;
        return r14139;
}

double f(double x) {
        double r14140 = x;
        double r14141 = -0.02582917538591079;
        bool r14142 = r14140 <= r14141;
        double r14143 = 0.02844105962587155;
        bool r14144 = r14140 <= r14143;
        double r14145 = !r14144;
        bool r14146 = r14142 || r14145;
        double r14147 = sin(r14140);
        double r14148 = r14140 - r14147;
        double r14149 = tan(r14140);
        double r14150 = r14140 - r14149;
        double r14151 = r14148 / r14150;
        double r14152 = 0.225;
        double r14153 = 2.0;
        double r14154 = pow(r14140, r14153);
        double r14155 = 0.009642857142857142;
        double r14156 = 4.0;
        double r14157 = pow(r14140, r14156);
        double r14158 = 0.5;
        double r14159 = fma(r14155, r14157, r14158);
        double r14160 = -r14159;
        double r14161 = fma(r14152, r14154, r14160);
        double r14162 = r14146 ? r14151 : r14161;
        return r14162;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.02582917538591079 or 0.02844105962587155 < x

    1. Initial program 0.0

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

    if -0.02582917538591079 < x < 0.02844105962587155

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

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

Reproduce

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