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

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left({x}^{4}, \frac{81}{1600}, -\left(\sqrt[3]{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{6}} \cdot \sqrt[3]{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{6}}\right) \cdot \sqrt[3]{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{6}}\right)}{\mathsf{fma}\left({x}^{2}, \frac{9}{40}, \mathsf{fma}\left({x}^{4}, \frac{27}{2800}, \frac{1}{2}\right)\right)}\\

\end{array}
double f(double x) {
        double r32412 = x;
        double r32413 = sin(r32412);
        double r32414 = r32412 - r32413;
        double r32415 = tan(r32412);
        double r32416 = r32412 - r32415;
        double r32417 = r32414 / r32416;
        return r32417;
}

double f(double x) {
        double r32418 = x;
        double r32419 = -0.028532925378081175;
        bool r32420 = r32418 <= r32419;
        double r32421 = 0.027540850594149503;
        bool r32422 = r32418 <= r32421;
        double r32423 = !r32422;
        bool r32424 = r32420 || r32423;
        double r32425 = sin(r32418);
        double r32426 = r32418 - r32425;
        double r32427 = tan(r32418);
        double r32428 = r32418 - r32427;
        double r32429 = r32426 / r32428;
        double r32430 = 4.0;
        double r32431 = pow(r32418, r32430);
        double r32432 = 0.050625;
        double r32433 = 0.009642857142857142;
        double r32434 = 0.5;
        double r32435 = fma(r32433, r32431, r32434);
        double r32436 = cbrt(r32435);
        double r32437 = 6.0;
        double r32438 = pow(r32436, r32437);
        double r32439 = cbrt(r32438);
        double r32440 = r32439 * r32439;
        double r32441 = r32440 * r32439;
        double r32442 = -r32441;
        double r32443 = fma(r32431, r32432, r32442);
        double r32444 = 2.0;
        double r32445 = pow(r32418, r32444);
        double r32446 = 0.225;
        double r32447 = fma(r32431, r32433, r32434);
        double r32448 = fma(r32445, r32446, r32447);
        double r32449 = r32443 / r32448;
        double r32450 = r32424 ? r32429 : r32449;
        return r32450;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.028532925378081175 or 0.027540850594149503 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]

    if -0.028532925378081175 < x < 0.027540850594149503

    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 flip--0.0

      \[\leadsto \color{blue}{\frac{\left(\frac{9}{40} \cdot {x}^{2}\right) \cdot \left(\frac{9}{40} \cdot {x}^{2}\right) - \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right) \cdot \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}{\frac{9}{40} \cdot {x}^{2} + \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}}\]
    6. Simplified1.6

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left({x}^{4}, \frac{81}{1600}, -{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{\left(2 \cdot 3\right)}\right)}}{\frac{9}{40} \cdot {x}^{2} + \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\]
    7. Simplified1.6

      \[\leadsto \frac{\mathsf{fma}\left({x}^{4}, \frac{81}{1600}, -{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{\left(2 \cdot 3\right)}\right)}{\color{blue}{\mathsf{fma}\left({x}^{2}, \frac{9}{40}, \mathsf{fma}\left({x}^{4}, \frac{27}{2800}, \frac{1}{2}\right)\right)}}\]
    8. Using strategy rm
    9. Applied add-cube-cbrt0.0

      \[\leadsto \frac{\mathsf{fma}\left({x}^{4}, \frac{81}{1600}, -\color{blue}{\left(\sqrt[3]{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{\left(2 \cdot 3\right)}} \cdot \sqrt[3]{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{\left(2 \cdot 3\right)}}\right) \cdot \sqrt[3]{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{\left(2 \cdot 3\right)}}}\right)}{\mathsf{fma}\left({x}^{2}, \frac{9}{40}, \mathsf{fma}\left({x}^{4}, \frac{27}{2800}, \frac{1}{2}\right)\right)}\]
    10. Simplified0.0

      \[\leadsto \frac{\mathsf{fma}\left({x}^{4}, \frac{81}{1600}, -\color{blue}{\left(\sqrt[3]{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{6}} \cdot \sqrt[3]{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{6}}\right)} \cdot \sqrt[3]{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{\left(2 \cdot 3\right)}}\right)}{\mathsf{fma}\left({x}^{2}, \frac{9}{40}, \mathsf{fma}\left({x}^{4}, \frac{27}{2800}, \frac{1}{2}\right)\right)}\]
    11. Simplified0.0

      \[\leadsto \frac{\mathsf{fma}\left({x}^{4}, \frac{81}{1600}, -\left(\sqrt[3]{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{6}} \cdot \sqrt[3]{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{6}}\right) \cdot \color{blue}{\sqrt[3]{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{6}}}\right)}{\mathsf{fma}\left({x}^{2}, \frac{9}{40}, \mathsf{fma}\left({x}^{4}, \frac{27}{2800}, \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.02853292537808117465547574909123795805499 \lor \neg \left(x \le 0.02754085059414950256706511311222129734233\right):\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left({x}^{4}, \frac{81}{1600}, -\left(\sqrt[3]{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{6}} \cdot \sqrt[3]{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{6}}\right) \cdot \sqrt[3]{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}\right)}^{6}}\right)}{\mathsf{fma}\left({x}^{2}, \frac{9}{40}, \mathsf{fma}\left({x}^{4}, \frac{27}{2800}, \frac{1}{2}\right)\right)}\\ \end{array}\]

Reproduce

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