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

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

\end{array}
double f(double x) {
        double r19554 = x;
        double r19555 = sin(r19554);
        double r19556 = r19554 - r19555;
        double r19557 = tan(r19554);
        double r19558 = r19554 - r19557;
        double r19559 = r19556 / r19558;
        return r19559;
}

double f(double x) {
        double r19560 = x;
        double r19561 = -0.029656023299900573;
        bool r19562 = r19560 <= r19561;
        double r19563 = 0.02964489669427243;
        bool r19564 = r19560 <= r19563;
        double r19565 = !r19564;
        bool r19566 = r19562 || r19565;
        double r19567 = sin(r19560);
        double r19568 = r19560 - r19567;
        double r19569 = tan(r19560);
        double r19570 = r19560 - r19569;
        double r19571 = r19568 / r19570;
        double r19572 = 0.225;
        double r19573 = r19560 * r19560;
        double r19574 = -0.5;
        double r19575 = fma(r19572, r19573, r19574);
        double r19576 = 4.0;
        double r19577 = pow(r19560, r19576);
        double r19578 = 0.009642857142857142;
        double r19579 = r19577 * r19578;
        double r19580 = r19575 - r19579;
        double r19581 = r19566 ? r19571 : r19580;
        return r19581;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.029656023299900573 or 0.02964489669427243 < x

    1. Initial program 0.0

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

    if -0.029656023299900573 < x < 0.02964489669427243

    1. Initial program 63.2

      \[\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 \cdot x, \frac{-1}{2}\right) - {x}^{4} \cdot \frac{27}{2800}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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