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

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

\end{array}
double f(double x) {
        double r27106 = x;
        double r27107 = sin(r27106);
        double r27108 = r27106 - r27107;
        double r27109 = tan(r27106);
        double r27110 = r27106 - r27109;
        double r27111 = r27108 / r27110;
        return r27111;
}

double f(double x) {
        double r27112 = x;
        double r27113 = -0.02915223248619924;
        bool r27114 = r27112 <= r27113;
        double r27115 = 0.028184310562944685;
        bool r27116 = r27112 <= r27115;
        double r27117 = !r27116;
        bool r27118 = r27114 || r27117;
        double r27119 = tan(r27112);
        double r27120 = r27112 - r27119;
        double r27121 = r27112 / r27120;
        double r27122 = 3.0;
        double r27123 = pow(r27121, r27122);
        double r27124 = sin(r27112);
        double r27125 = r27124 / r27120;
        double r27126 = pow(r27125, r27122);
        double r27127 = r27123 - r27126;
        double r27128 = r27125 + r27121;
        double r27129 = r27125 * r27128;
        double r27130 = fma(r27121, r27121, r27129);
        double r27131 = r27127 / r27130;
        double r27132 = 2.0;
        double r27133 = pow(r27112, r27132);
        double r27134 = 0.225;
        double r27135 = -0.009642857142857142;
        double r27136 = 4.0;
        double r27137 = pow(r27112, r27136);
        double r27138 = r27135 * r27137;
        double r27139 = fma(r27133, r27134, r27138);
        double r27140 = 0.5;
        double r27141 = r27139 - r27140;
        double r27142 = r27118 ? r27131 : r27141;
        return r27142;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.02915223248619924 or 0.028184310562944685 < x

    1. Initial program 0.0

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

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
    4. Using strategy rm
    5. Applied flip3--0.1

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

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

    if -0.02915223248619924 < x < 0.028184310562944685

    1. Initial program 63.2

      \[\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}{\frac{9}{40} \cdot {x}^{2} - \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\]
    4. Using strategy rm
    5. Applied fma-udef0.0

      \[\leadsto \frac{9}{40} \cdot {x}^{2} - \color{blue}{\left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}\]
    6. Applied associate--r+0.0

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

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

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

Reproduce

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