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

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

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

\end{array}
double f(double x) {
        double r773379 = x;
        double r773380 = sin(r773379);
        double r773381 = r773379 - r773380;
        double r773382 = tan(r773379);
        double r773383 = r773379 - r773382;
        double r773384 = r773381 / r773383;
        return r773384;
}

double f(double x) {
        double r773385 = x;
        double r773386 = -0.029656023299900573;
        bool r773387 = r773385 <= r773386;
        double r773388 = sin(r773385);
        double r773389 = r773385 - r773388;
        double r773390 = tan(r773385);
        double r773391 = r773385 - r773390;
        double r773392 = r773389 / r773391;
        double r773393 = 0.02964489669427243;
        bool r773394 = r773385 <= r773393;
        double r773395 = 0.225;
        double r773396 = r773385 * r773385;
        double r773397 = -0.5;
        double r773398 = fma(r773395, r773396, r773397);
        double r773399 = 0.009642857142857142;
        double r773400 = r773399 * r773396;
        double r773401 = r773396 * r773400;
        double r773402 = r773398 - r773401;
        double r773403 = r773394 ? r773402 : r773392;
        double r773404 = r773387 ? r773392 : r773403;
        return r773404;
}

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}\]
    2. Using strategy rm
    3. Applied div-sub0.0

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
    4. Using strategy rm
    5. Applied sub-div0.0

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

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

Reproduce

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