Average Error: 31.9 → 0.0
Time: 29.4s
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 r547510 = x;
        double r547511 = sin(r547510);
        double r547512 = r547510 - r547511;
        double r547513 = tan(r547510);
        double r547514 = r547510 - r547513;
        double r547515 = r547512 / r547514;
        return r547515;
}

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

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))))