Average Error: 31.1 → 0.0
Time: 26.0s
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 r20213 = x;
        double r20214 = sin(r20213);
        double r20215 = r20213 - r20214;
        double r20216 = tan(r20213);
        double r20217 = r20213 - r20216;
        double r20218 = r20215 / r20217;
        return r20218;
}

double f(double x) {
        double r20219 = x;
        double r20220 = -0.02915706671350092;
        bool r20221 = r20219 <= r20220;
        double r20222 = 0.029468351736831863;
        bool r20223 = r20219 <= r20222;
        double r20224 = !r20223;
        bool r20225 = r20221 || r20224;
        double r20226 = 1.0;
        double r20227 = tan(r20219);
        double r20228 = r20219 - r20227;
        double r20229 = sin(r20219);
        double r20230 = r20219 - r20229;
        double r20231 = r20228 / r20230;
        double r20232 = r20226 / r20231;
        double r20233 = 0.225;
        double r20234 = 2.0;
        double r20235 = pow(r20219, r20234);
        double r20236 = 4.0;
        double r20237 = pow(r20219, r20236);
        double r20238 = -0.009642857142857142;
        double r20239 = r20237 * r20238;
        double r20240 = fma(r20233, r20235, r20239);
        double r20241 = 0.5;
        double r20242 = r20240 - r20241;
        double r20243 = r20225 ? r20232 : r20242;
        return r20243;
}

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