Average Error: 31.9 → 0.1
Time: 10.8s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0327110828731407635 \lor \neg \left(x \le 0.035536581865690961\right):\\ \;\;\;\;\mathsf{fma}\left(\sqrt[3]{\frac{x}{x - \tan x}} \cdot \sqrt[3]{\frac{x}{x - \tan x}}, \sqrt[3]{\frac{x}{x - \tan x}}, -\frac{\sin x}{x - \tan x}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.0327110828731407635 \lor \neg \left(x \le 0.035536581865690961\right):\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{\frac{x}{x - \tan x}} \cdot \sqrt[3]{\frac{x}{x - \tan x}}, \sqrt[3]{\frac{x}{x - \tan x}}, -\frac{\sin x}{x - \tan x}\right)\\

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

\end{array}
double f(double x) {
        double r15757 = x;
        double r15758 = sin(r15757);
        double r15759 = r15757 - r15758;
        double r15760 = tan(r15757);
        double r15761 = r15757 - r15760;
        double r15762 = r15759 / r15761;
        return r15762;
}

double f(double x) {
        double r15763 = x;
        double r15764 = -0.032711082873140764;
        bool r15765 = r15763 <= r15764;
        double r15766 = 0.03553658186569096;
        bool r15767 = r15763 <= r15766;
        double r15768 = !r15767;
        bool r15769 = r15765 || r15768;
        double r15770 = tan(r15763);
        double r15771 = r15763 - r15770;
        double r15772 = r15763 / r15771;
        double r15773 = cbrt(r15772);
        double r15774 = r15773 * r15773;
        double r15775 = sin(r15763);
        double r15776 = r15775 / r15771;
        double r15777 = -r15776;
        double r15778 = fma(r15774, r15773, r15777);
        double r15779 = 0.225;
        double r15780 = 2.0;
        double r15781 = pow(r15763, r15780);
        double r15782 = 0.009642857142857142;
        double r15783 = 4.0;
        double r15784 = pow(r15763, r15783);
        double r15785 = 0.5;
        double r15786 = fma(r15782, r15784, r15785);
        double r15787 = -r15786;
        double r15788 = fma(r15779, r15781, r15787);
        double r15789 = r15769 ? r15778 : r15788;
        return r15789;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.032711082873140764 or 0.03553658186569096 < 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 add-cube-cbrt0.1

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{x}{x - \tan x}} \cdot \sqrt[3]{\frac{x}{x - \tan x}}\right) \cdot \sqrt[3]{\frac{x}{x - \tan x}}} - \frac{\sin x}{x - \tan x}\]
    6. Applied fma-neg0.1

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

    if -0.032711082873140764 < x < 0.03553658186569096

    1. Initial program 63.3

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

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

Reproduce

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