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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{\frac{x - \tan x}{x - \sin x}}\right)\right)\\

\end{array}
double f(double x) {
        double r802550 = x;
        double r802551 = sin(r802550);
        double r802552 = r802550 - r802551;
        double r802553 = tan(r802550);
        double r802554 = r802550 - r802553;
        double r802555 = r802552 / r802554;
        return r802555;
}

double f(double x) {
        double r802556 = x;
        double r802557 = -0.0287527250874288;
        bool r802558 = r802556 <= r802557;
        double r802559 = sin(r802556);
        double r802560 = r802556 - r802559;
        double r802561 = tan(r802556);
        double r802562 = r802556 - r802561;
        double r802563 = r802560 / r802562;
        double r802564 = expm1(r802563);
        double r802565 = log1p(r802564);
        double r802566 = 0.029335377355220408;
        bool r802567 = r802556 <= r802566;
        double r802568 = -0.009642857142857142;
        double r802569 = r802556 * r802556;
        double r802570 = r802569 * r802569;
        double r802571 = r802568 * r802570;
        double r802572 = 0.225;
        double r802573 = -0.5;
        double r802574 = fma(r802569, r802572, r802573);
        double r802575 = r802571 + r802574;
        double r802576 = 1.0;
        double r802577 = r802562 / r802560;
        double r802578 = r802576 / r802577;
        double r802579 = expm1(r802578);
        double r802580 = log1p(r802579);
        double r802581 = r802567 ? r802575 : r802580;
        double r802582 = r802558 ? r802565 : r802581;
        return r802582;
}

Error

Bits error versus x

Derivation

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

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied log1p-expm1-u0.0

      \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x - \sin x}{x - \tan x}\right)\right)}\]

    if -0.0287527250874288 < x < 0.029335377355220408

    1. Initial program 62.7

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

    if 0.029335377355220408 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied log1p-expm1-u0.0

      \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x - \sin x}{x - \tan x}\right)\right)}\]
    4. Using strategy rm
    5. Applied clear-num0.1

      \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\frac{1}{\frac{x - \tan x}{x - \sin x}}}\right)\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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