Average Error: 30.6 → 0.0
Time: 11.2s
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 r21236 = x;
        double r21237 = sin(r21236);
        double r21238 = r21236 - r21237;
        double r21239 = tan(r21236);
        double r21240 = r21236 - r21239;
        double r21241 = r21238 / r21240;
        return r21241;
}

double f(double x) {
        double r21242 = x;
        double r21243 = -0.026260449326479987;
        bool r21244 = r21242 <= r21243;
        double r21245 = 0.027484538016213013;
        bool r21246 = r21242 <= r21245;
        double r21247 = !r21246;
        bool r21248 = r21244 || r21247;
        double r21249 = 1.0;
        double r21250 = sin(r21242);
        double r21251 = r21242 - r21250;
        double r21252 = r21242 / r21251;
        double r21253 = tan(r21242);
        double r21254 = r21253 / r21251;
        double r21255 = r21252 - r21254;
        double r21256 = r21249 / r21255;
        double r21257 = 0.225;
        double r21258 = 2.0;
        double r21259 = pow(r21242, r21258);
        double r21260 = 0.009642857142857142;
        double r21261 = 4.0;
        double r21262 = pow(r21242, r21261);
        double r21263 = 0.5;
        double r21264 = fma(r21260, r21262, r21263);
        double r21265 = -r21264;
        double r21266 = fma(r21257, r21259, r21265);
        double r21267 = r21248 ? r21256 : r21266;
        return r21267;
}

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))))