Average Error: 31.9 → 0.0
Time: 28.8s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02911457298168511689806514652900659712031:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.02897311180941740046956844878422998590395:\\ \;\;\;\;\mathsf{fma}\left(x \cdot x, \frac{9}{40}, \mathsf{fma}\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{-27}{2800}, \frac{-1}{2}\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.02911457298168511689806514652900659712031:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

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

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

\end{array}
double f(double x) {
        double r547512 = x;
        double r547513 = sin(r547512);
        double r547514 = r547512 - r547513;
        double r547515 = tan(r547512);
        double r547516 = r547512 - r547515;
        double r547517 = r547514 / r547516;
        return r547517;
}

double f(double x) {
        double r547518 = x;
        double r547519 = -0.029114572981685117;
        bool r547520 = r547518 <= r547519;
        double r547521 = tan(r547518);
        double r547522 = r547518 - r547521;
        double r547523 = r547518 / r547522;
        double r547524 = sin(r547518);
        double r547525 = r547524 / r547522;
        double r547526 = r547523 - r547525;
        double r547527 = 0.0289731118094174;
        bool r547528 = r547518 <= r547527;
        double r547529 = r547518 * r547518;
        double r547530 = 0.225;
        double r547531 = r547529 * r547529;
        double r547532 = -0.009642857142857142;
        double r547533 = -0.5;
        double r547534 = fma(r547531, r547532, r547533);
        double r547535 = fma(r547529, r547530, r547534);
        double r547536 = r547518 - r547524;
        double r547537 = r547536 / r547522;
        double r547538 = r547528 ? r547535 : r547537;
        double r547539 = r547520 ? r547526 : r547538;
        return r547539;
}

Error

Bits error versus x

Derivation

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

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub0.1

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

    if -0.029114572981685117 < x < 0.0289731118094174

    1. Initial program 63.3

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

    if 0.0289731118094174 < x

    1. Initial program 0.0

      \[\frac{x - \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.02911457298168511689806514652900659712031:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.02897311180941740046956844878422998590395:\\ \;\;\;\;\mathsf{fma}\left(x \cdot x, \frac{9}{40}, \mathsf{fma}\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{-27}{2800}, \frac{-1}{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \end{array}\]

Reproduce

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