Average Error: 30.6 → 0.0
Time: 14.5s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.026260449326479987 \lor \neg \left(x \le 0.027484538016213013\right):\\ \;\;\;\;\frac{1}{\frac{x}{x - \sin x} - \frac{\tan x}{x - \sin x}}\\ \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.026260449326479987 \lor \neg \left(x \le 0.027484538016213013\right):\\
\;\;\;\;\frac{1}{\frac{x}{x - \sin x} - \frac{\tan x}{x - \sin x}}\\

\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 r65 = x;
        double r66 = sin(r65);
        double r67 = r65 - r66;
        double r68 = tan(r65);
        double r69 = r65 - r68;
        double r70 = r67 / r69;
        return r70;
}

double f(double x) {
        double r71 = x;
        double r72 = -0.026260449326479987;
        bool r73 = r71 <= r72;
        double r74 = 0.027484538016213013;
        bool r75 = r71 <= r74;
        double r76 = !r75;
        bool r77 = r73 || r76;
        double r78 = 1.0;
        double r79 = sin(r71);
        double r80 = r71 - r79;
        double r81 = r71 / r80;
        double r82 = tan(r71);
        double r83 = r82 / r80;
        double r84 = r81 - r83;
        double r85 = r78 / r84;
        double r86 = 0.225;
        double r87 = 2.0;
        double r88 = pow(r71, r87);
        double r89 = 0.009642857142857142;
        double r90 = 4.0;
        double r91 = pow(r71, r90);
        double r92 = 0.5;
        double r93 = fma(r89, r91, r92);
        double r94 = -r93;
        double r95 = fma(r86, r88, r94);
        double r96 = r77 ? r85 : r95;
        return r96;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.026260449326479987 or 0.027484538016213013 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt1.4

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

      \[\leadsto \frac{x - \sin x}{\color{blue}{\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\tan x\right)}}\]
    5. Using strategy rm
    6. Applied clear-num1.4

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

      \[\leadsto \frac{1}{\color{blue}{\frac{x}{x - \sin x} - \frac{\tan x}{x - \sin x}}}\]

    if -0.026260449326479987 < x < 0.027484538016213013

    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}{\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.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.026260449326479987 \lor \neg \left(x \le 0.027484538016213013\right):\\ \;\;\;\;\frac{1}{\frac{x}{x - \sin x} - \frac{\tan x}{x - \sin x}}\\ \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 2020025 +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))