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

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

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

\end{array}
double f(double x) {
        double r751544 = x;
        double r751545 = sin(r751544);
        double r751546 = r751544 - r751545;
        double r751547 = tan(r751544);
        double r751548 = r751544 - r751547;
        double r751549 = r751546 / r751548;
        return r751549;
}

double f(double x) {
        double r751550 = x;
        double r751551 = -0.026370186168873697;
        bool r751552 = r751550 <= r751551;
        double r751553 = sin(r751550);
        double r751554 = r751550 - r751553;
        double r751555 = tan(r751550);
        double r751556 = r751550 - r751555;
        double r751557 = r751554 / r751556;
        double r751558 = 0.02458873884700214;
        bool r751559 = r751550 <= r751558;
        double r751560 = 0.225;
        double r751561 = r751550 * r751550;
        double r751562 = -0.009642857142857142;
        double r751563 = r751561 * r751561;
        double r751564 = -0.5;
        double r751565 = fma(r751562, r751563, r751564);
        double r751566 = fma(r751560, r751561, r751565);
        double r751567 = r751550 / r751556;
        double r751568 = r751553 / r751556;
        double r751569 = r751567 - r751568;
        double r751570 = r751559 ? r751566 : r751569;
        double r751571 = r751552 ? r751557 : r751570;
        return r751571;
}

Error

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if x < -0.026370186168873697

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied flip3--41.7

      \[\leadsto \frac{\color{blue}{\frac{{x}^{3} - {\left(\sin x\right)}^{3}}{x \cdot x + \left(\sin x \cdot \sin x + x \cdot \sin x\right)}}}{x - \tan x}\]
    4. Simplified41.7

      \[\leadsto \frac{\frac{\color{blue}{\left(x \cdot x\right) \cdot x - \sin x \cdot \left(\sin x \cdot \sin x\right)}}{x \cdot x + \left(\sin x \cdot \sin x + x \cdot \sin x\right)}}{x - \tan x}\]
    5. Taylor expanded around inf 0.0

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

    if -0.026370186168873697 < x < 0.02458873884700214

    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, \mathsf{fma}\left(\frac{-27}{2800}, \left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{-1}{2}\right)\right)}\]

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

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

Reproduce

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