Average Error: 32.0 → 0.0
Time: 28.1s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.03200837114588730991648901635926449671388 \lor \neg \left(x \le 0.03060897347615410338250718780273018637672\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\frac{9}{40} \cdot \left(x \cdot x\right) - \mathsf{fma}\left({x}^{4}, \frac{27}{2800}, \frac{1}{2}\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.03200837114588730991648901635926449671388 \lor \neg \left(x \le 0.03060897347615410338250718780273018637672\right):\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

\mathbf{else}:\\
\;\;\;\;\frac{9}{40} \cdot \left(x \cdot x\right) - \mathsf{fma}\left({x}^{4}, \frac{27}{2800}, \frac{1}{2}\right)\\

\end{array}
double f(double x) {
        double r31825 = x;
        double r31826 = sin(r31825);
        double r31827 = r31825 - r31826;
        double r31828 = tan(r31825);
        double r31829 = r31825 - r31828;
        double r31830 = r31827 / r31829;
        return r31830;
}

double f(double x) {
        double r31831 = x;
        double r31832 = -0.03200837114588731;
        bool r31833 = r31831 <= r31832;
        double r31834 = 0.030608973476154103;
        bool r31835 = r31831 <= r31834;
        double r31836 = !r31835;
        bool r31837 = r31833 || r31836;
        double r31838 = tan(r31831);
        double r31839 = r31831 - r31838;
        double r31840 = r31831 / r31839;
        double r31841 = sin(r31831);
        double r31842 = r31841 / r31839;
        double r31843 = r31840 - r31842;
        double r31844 = 0.225;
        double r31845 = r31831 * r31831;
        double r31846 = r31844 * r31845;
        double r31847 = 4.0;
        double r31848 = pow(r31831, r31847);
        double r31849 = 0.009642857142857142;
        double r31850 = 0.5;
        double r31851 = fma(r31848, r31849, r31850);
        double r31852 = r31846 - r31851;
        double r31853 = r31837 ? r31843 : r31852;
        return r31853;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.03200837114588731 or 0.030608973476154103 < x

    1. Initial program 0.0

      \[\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.03200837114588731 < x < 0.030608973476154103

    1. Initial program 63.1

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

      \[\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}{\frac{9}{40} \cdot \left(x \cdot x\right) - \mathsf{fma}\left({x}^{4}, \frac{27}{2800}, \frac{1}{2}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.03200837114588730991648901635926449671388 \lor \neg \left(x \le 0.03060897347615410338250718780273018637672\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\frac{9}{40} \cdot \left(x \cdot x\right) - \mathsf{fma}\left({x}^{4}, \frac{27}{2800}, \frac{1}{2}\right)\\ \end{array}\]

Reproduce

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