Average Error: 31.9 → 0.0
Time: 28.3s
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:\\ \;\;\;\;\left(x \cdot x\right) \cdot \frac{9}{40} - \mathsf{fma}\left(\frac{27}{2800}, \left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{1}{2}\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:\\
\;\;\;\;\left(x \cdot x\right) \cdot \frac{9}{40} - \mathsf{fma}\left(\frac{27}{2800}, \left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{1}{2}\right)\\

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

\end{array}
double f(double x) {
        double r560053 = x;
        double r560054 = sin(r560053);
        double r560055 = r560053 - r560054;
        double r560056 = tan(r560053);
        double r560057 = r560053 - r560056;
        double r560058 = r560055 / r560057;
        return r560058;
}

double f(double x) {
        double r560059 = x;
        double r560060 = -0.029114572981685117;
        bool r560061 = r560059 <= r560060;
        double r560062 = tan(r560059);
        double r560063 = r560059 - r560062;
        double r560064 = r560059 / r560063;
        double r560065 = sin(r560059);
        double r560066 = r560065 / r560063;
        double r560067 = r560064 - r560066;
        double r560068 = 0.0289731118094174;
        bool r560069 = r560059 <= r560068;
        double r560070 = r560059 * r560059;
        double r560071 = 0.225;
        double r560072 = r560070 * r560071;
        double r560073 = 0.009642857142857142;
        double r560074 = r560070 * r560070;
        double r560075 = 0.5;
        double r560076 = fma(r560073, r560074, r560075);
        double r560077 = r560072 - r560076;
        double r560078 = r560059 - r560065;
        double r560079 = r560078 / r560063;
        double r560080 = r560069 ? r560077 : r560079;
        double r560081 = r560061 ? r560067 : r560080;
        return r560081;
}

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. Using strategy rm
    3. Applied div-sub63.2

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
    4. 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)}\]
    5. Simplified0.0

      \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \frac{9}{40} - \mathsf{fma}\left(\frac{27}{2800}, \left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{1}{2}\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:\\ \;\;\;\;\left(x \cdot x\right) \cdot \frac{9}{40} - \mathsf{fma}\left(\frac{27}{2800}, \left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{1}{2}\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))))