Average Error: 31.2 → 0.0
Time: 10.4s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.025771746480745088 \lor \neg \left(x \le 0.029999746059236519\right):\\ \;\;\;\;\frac{x - \sin x}{x - \tan 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.025771746480745088 \lor \neg \left(x \le 0.029999746059236519\right):\\
\;\;\;\;\frac{x - \sin x}{x - \tan 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 r14908 = x;
        double r14909 = sin(r14908);
        double r14910 = r14908 - r14909;
        double r14911 = tan(r14908);
        double r14912 = r14908 - r14911;
        double r14913 = r14910 / r14912;
        return r14913;
}

double f(double x) {
        double r14914 = x;
        double r14915 = -0.025771746480745088;
        bool r14916 = r14914 <= r14915;
        double r14917 = 0.02999974605923652;
        bool r14918 = r14914 <= r14917;
        double r14919 = !r14918;
        bool r14920 = r14916 || r14919;
        double r14921 = sin(r14914);
        double r14922 = r14914 - r14921;
        double r14923 = tan(r14914);
        double r14924 = r14914 - r14923;
        double r14925 = r14922 / r14924;
        double r14926 = 0.225;
        double r14927 = 2.0;
        double r14928 = pow(r14914, r14927);
        double r14929 = 0.009642857142857142;
        double r14930 = 4.0;
        double r14931 = pow(r14914, r14930);
        double r14932 = 0.5;
        double r14933 = fma(r14929, r14931, r14932);
        double r14934 = -r14933;
        double r14935 = fma(r14926, r14928, r14934);
        double r14936 = r14920 ? r14925 : r14935;
        return r14936;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.025771746480745088 or 0.02999974605923652 < 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 sub-div0.0

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

    if -0.025771746480745088 < x < 0.02999974605923652

    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.025771746480745088 \lor \neg \left(x \le 0.029999746059236519\right):\\ \;\;\;\;\frac{x - \sin x}{x - \tan 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 2020064 +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))