Average Error: 31.1 → 0.0
Time: 26.1s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02915706671350092038519363768500625155866 \lor \neg \left(x \le 0.0294683517368318631524104489471937995404\right):\\ \;\;\;\;\frac{1}{\frac{x - \tan x}{x - \sin x}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, {x}^{4} \cdot \frac{-27}{2800}\right) - \frac{1}{2}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.02915706671350092038519363768500625155866 \lor \neg \left(x \le 0.0294683517368318631524104489471937995404\right):\\
\;\;\;\;\frac{1}{\frac{x - \tan x}{x - \sin x}}\\

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

\end{array}
double f(double x) {
        double r20175 = x;
        double r20176 = sin(r20175);
        double r20177 = r20175 - r20176;
        double r20178 = tan(r20175);
        double r20179 = r20175 - r20178;
        double r20180 = r20177 / r20179;
        return r20180;
}

double f(double x) {
        double r20181 = x;
        double r20182 = -0.02915706671350092;
        bool r20183 = r20181 <= r20182;
        double r20184 = 0.029468351736831863;
        bool r20185 = r20181 <= r20184;
        double r20186 = !r20185;
        bool r20187 = r20183 || r20186;
        double r20188 = 1.0;
        double r20189 = tan(r20181);
        double r20190 = r20181 - r20189;
        double r20191 = sin(r20181);
        double r20192 = r20181 - r20191;
        double r20193 = r20190 / r20192;
        double r20194 = r20188 / r20193;
        double r20195 = 0.225;
        double r20196 = 2.0;
        double r20197 = pow(r20181, r20196);
        double r20198 = 4.0;
        double r20199 = pow(r20181, r20198);
        double r20200 = -0.009642857142857142;
        double r20201 = r20199 * r20200;
        double r20202 = fma(r20195, r20197, r20201);
        double r20203 = 0.5;
        double r20204 = r20202 - r20203;
        double r20205 = r20187 ? r20194 : r20204;
        return r20205;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.02915706671350092 or 0.029468351736831863 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied clear-num0.0

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

    if -0.02915706671350092 < x < 0.029468351736831863

    1. Initial program 63.1

      \[\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 fma-udef0.0

      \[\leadsto \frac{9}{40} \cdot {x}^{2} - \color{blue}{\left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}\]
    6. Applied associate--r+0.0

      \[\leadsto \color{blue}{\left(\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}}\]
    7. Simplified0.0

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, {x}^{4} \cdot \frac{-27}{2800}\right)} - \frac{1}{2}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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