Average Error: 31.1 → 0.3
Time: 33.3s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.4489045375766514:\\ \;\;\;\;\mathsf{fma}\left(\frac{\frac{\sin x}{x}}{x}, \frac{\sin x}{\cos x \cdot \cos x}, \frac{\sin x}{\cos x \cdot x} - \mathsf{fma}\left(\frac{\frac{\sin x}{x}}{x}, \frac{\sin x}{\cos x}, \frac{\sin x}{x}\right)\right) + 1\\ \mathbf{elif}\;x \le 2.4331115039478592:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(\frac{9}{40} - \frac{27}{2800} \cdot \left(x \cdot x\right)\right) - \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\frac{\sin x}{x}}{x}, \frac{\sin x}{\cos x \cdot \cos x}, \frac{\sin x}{\cos x \cdot x} - \mathsf{fma}\left(\frac{\frac{\sin x}{x}}{x}, \frac{\sin x}{\cos x}, \frac{\sin x}{x}\right)\right) + 1\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -2.4489045375766514:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{\sin x}{x}}{x}, \frac{\sin x}{\cos x \cdot \cos x}, \frac{\sin x}{\cos x \cdot x} - \mathsf{fma}\left(\frac{\frac{\sin x}{x}}{x}, \frac{\sin x}{\cos x}, \frac{\sin x}{x}\right)\right) + 1\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{\sin x}{x}}{x}, \frac{\sin x}{\cos x \cdot \cos x}, \frac{\sin x}{\cos x \cdot x} - \mathsf{fma}\left(\frac{\frac{\sin x}{x}}{x}, \frac{\sin x}{\cos x}, \frac{\sin x}{x}\right)\right) + 1\\

\end{array}
double f(double x) {
        double r664842 = x;
        double r664843 = sin(r664842);
        double r664844 = r664842 - r664843;
        double r664845 = tan(r664842);
        double r664846 = r664842 - r664845;
        double r664847 = r664844 / r664846;
        return r664847;
}

double f(double x) {
        double r664848 = x;
        double r664849 = -2.4489045375766514;
        bool r664850 = r664848 <= r664849;
        double r664851 = sin(r664848);
        double r664852 = r664851 / r664848;
        double r664853 = r664852 / r664848;
        double r664854 = cos(r664848);
        double r664855 = r664854 * r664854;
        double r664856 = r664851 / r664855;
        double r664857 = r664854 * r664848;
        double r664858 = r664851 / r664857;
        double r664859 = r664851 / r664854;
        double r664860 = fma(r664853, r664859, r664852);
        double r664861 = r664858 - r664860;
        double r664862 = fma(r664853, r664856, r664861);
        double r664863 = 1.0;
        double r664864 = r664862 + r664863;
        double r664865 = 2.4331115039478592;
        bool r664866 = r664848 <= r664865;
        double r664867 = r664848 * r664848;
        double r664868 = 0.225;
        double r664869 = 0.009642857142857142;
        double r664870 = r664869 * r664867;
        double r664871 = r664868 - r664870;
        double r664872 = r664867 * r664871;
        double r664873 = 0.5;
        double r664874 = r664872 - r664873;
        double r664875 = r664866 ? r664874 : r664864;
        double r664876 = r664850 ? r664864 : r664875;
        return r664876;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -2.4489045375766514 or 2.4331115039478592 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around inf 0.4

      \[\leadsto \color{blue}{\left(1 + \left(\frac{{\left(\sin x\right)}^{2}}{{\left(\cos x\right)}^{2} \cdot {x}^{2}} + \frac{\sin x}{\cos x \cdot x}\right)\right) - \left(\frac{\sin x}{x} + \frac{{\left(\sin x\right)}^{2}}{\cos x \cdot {x}^{2}}\right)}\]
    3. Simplified0.4

      \[\leadsto \color{blue}{1 + \mathsf{fma}\left(\frac{\frac{\sin x}{x}}{x}, \frac{\sin x}{\cos x \cdot \cos x}, \frac{\sin x}{x \cdot \cos x} - \mathsf{fma}\left(\frac{\frac{\sin x}{x}}{x}, \frac{\sin x}{\cos x}, \frac{\sin x}{x}\right)\right)}\]

    if -2.4489045375766514 < x < 2.4331115039478592

    1. Initial program 62.2

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around 0 0.3

      \[\leadsto \color{blue}{\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}\]
    3. Simplified0.3

      \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \left(\frac{9}{40} - \frac{27}{2800} \cdot \left(x \cdot x\right)\right) - \frac{1}{2}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

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

Reproduce

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