Average Error: 31.2 → 0.1
Time: 4.2m
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.029887138607399076:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.02664140531633685:\\ \;\;\;\;(\left(x \cdot x\right) \cdot \frac{9}{40} + \left((\frac{-27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) + \frac{-1}{2})_*\right))_*\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{(\left(\frac{\frac{x}{\tan x + x}}{x - \tan x}\right) \cdot \left(\tan x + x\right) + \left(-\frac{\sin x}{x - \tan x}\right))_*} \cdot \sqrt[3]{(\left(\frac{\frac{x}{\tan x + x}}{x - \tan x}\right) \cdot \left(\tan x + x\right) + \left(-\frac{\sin x}{x - \tan x}\right))_*}\right) \cdot \sqrt[3]{(\left(\frac{\frac{x}{\tan x + x}}{x - \tan x}\right) \cdot \left(\tan x + x\right) + \left(-\frac{\sin x}{x - \tan x}\right))_*}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.029887138607399076:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

\mathbf{elif}\;x \le 0.02664140531633685:\\
\;\;\;\;(\left(x \cdot x\right) \cdot \frac{9}{40} + \left((\frac{-27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) + \frac{-1}{2})_*\right))_*\\

\mathbf{else}:\\
\;\;\;\;\left(\sqrt[3]{(\left(\frac{\frac{x}{\tan x + x}}{x - \tan x}\right) \cdot \left(\tan x + x\right) + \left(-\frac{\sin x}{x - \tan x}\right))_*} \cdot \sqrt[3]{(\left(\frac{\frac{x}{\tan x + x}}{x - \tan x}\right) \cdot \left(\tan x + x\right) + \left(-\frac{\sin x}{x - \tan x}\right))_*}\right) \cdot \sqrt[3]{(\left(\frac{\frac{x}{\tan x + x}}{x - \tan x}\right) \cdot \left(\tan x + x\right) + \left(-\frac{\sin x}{x - \tan x}\right))_*}\\

\end{array}
double f(double x) {
        double r7737168 = x;
        double r7737169 = sin(r7737168);
        double r7737170 = r7737168 - r7737169;
        double r7737171 = tan(r7737168);
        double r7737172 = r7737168 - r7737171;
        double r7737173 = r7737170 / r7737172;
        return r7737173;
}

double f(double x) {
        double r7737174 = x;
        double r7737175 = -0.029887138607399076;
        bool r7737176 = r7737174 <= r7737175;
        double r7737177 = tan(r7737174);
        double r7737178 = r7737174 - r7737177;
        double r7737179 = r7737174 / r7737178;
        double r7737180 = sin(r7737174);
        double r7737181 = r7737180 / r7737178;
        double r7737182 = r7737179 - r7737181;
        double r7737183 = 0.02664140531633685;
        bool r7737184 = r7737174 <= r7737183;
        double r7737185 = r7737174 * r7737174;
        double r7737186 = 0.225;
        double r7737187 = -0.009642857142857142;
        double r7737188 = r7737185 * r7737185;
        double r7737189 = -0.5;
        double r7737190 = fma(r7737187, r7737188, r7737189);
        double r7737191 = fma(r7737185, r7737186, r7737190);
        double r7737192 = r7737177 + r7737174;
        double r7737193 = r7737174 / r7737192;
        double r7737194 = r7737193 / r7737178;
        double r7737195 = -r7737181;
        double r7737196 = fma(r7737194, r7737192, r7737195);
        double r7737197 = cbrt(r7737196);
        double r7737198 = r7737197 * r7737197;
        double r7737199 = r7737198 * r7737197;
        double r7737200 = r7737184 ? r7737191 : r7737199;
        double r7737201 = r7737176 ? r7737182 : r7737200;
        return r7737201;
}

Error

Bits error versus x

Derivation

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

    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.029887138607399076 < x < 0.02664140531633685

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

    if 0.02664140531633685 < x

    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}}\]
    4. Using strategy rm
    5. Applied flip--30.3

      \[\leadsto \frac{x}{\color{blue}{\frac{x \cdot x - \tan x \cdot \tan x}{x + \tan x}}} - \frac{\sin x}{x - \tan x}\]
    6. Applied associate-/r/30.4

      \[\leadsto \color{blue}{\frac{x}{x \cdot x - \tan x \cdot \tan x} \cdot \left(x + \tan x\right)} - \frac{\sin x}{x - \tan x}\]
    7. Applied fma-neg30.4

      \[\leadsto \color{blue}{(\left(\frac{x}{x \cdot x - \tan x \cdot \tan x}\right) \cdot \left(x + \tan x\right) + \left(-\frac{\sin x}{x - \tan x}\right))_*}\]
    8. Simplified0.2

      \[\leadsto (\color{blue}{\left(\frac{\frac{x}{x + \tan x}}{x - \tan x}\right)} \cdot \left(x + \tan x\right) + \left(-\frac{\sin x}{x - \tan x}\right))_*\]
    9. Using strategy rm
    10. Applied add-cube-cbrt0.1

      \[\leadsto \color{blue}{\left(\sqrt[3]{(\left(\frac{\frac{x}{x + \tan x}}{x - \tan x}\right) \cdot \left(x + \tan x\right) + \left(-\frac{\sin x}{x - \tan x}\right))_*} \cdot \sqrt[3]{(\left(\frac{\frac{x}{x + \tan x}}{x - \tan x}\right) \cdot \left(x + \tan x\right) + \left(-\frac{\sin x}{x - \tan x}\right))_*}\right) \cdot \sqrt[3]{(\left(\frac{\frac{x}{x + \tan x}}{x - \tan x}\right) \cdot \left(x + \tan x\right) + \left(-\frac{\sin x}{x - \tan x}\right))_*}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.029887138607399076:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.02664140531633685:\\ \;\;\;\;(\left(x \cdot x\right) \cdot \frac{9}{40} + \left((\frac{-27}{2800} \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) + \frac{-1}{2})_*\right))_*\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{(\left(\frac{\frac{x}{\tan x + x}}{x - \tan x}\right) \cdot \left(\tan x + x\right) + \left(-\frac{\sin x}{x - \tan x}\right))_*} \cdot \sqrt[3]{(\left(\frac{\frac{x}{\tan x + x}}{x - \tan x}\right) \cdot \left(\tan x + x\right) + \left(-\frac{\sin x}{x - \tan x}\right))_*}\right) \cdot \sqrt[3]{(\left(\frac{\frac{x}{\tan x + x}}{x - \tan x}\right) \cdot \left(\tan x + x\right) + \left(-\frac{\sin x}{x - \tan x}\right))_*}\\ \end{array}\]

Reproduce

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