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

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

\end{array}
double f(double x) {
        double r9938 = x;
        double r9939 = sin(r9938);
        double r9940 = r9938 - r9939;
        double r9941 = tan(r9938);
        double r9942 = r9938 - r9941;
        double r9943 = r9940 / r9942;
        return r9943;
}

double f(double x) {
        double r9944 = x;
        double r9945 = -0.02894118494710049;
        bool r9946 = r9944 <= r9945;
        double r9947 = 0.028078975194333212;
        bool r9948 = r9944 <= r9947;
        double r9949 = !r9948;
        bool r9950 = r9946 || r9949;
        double r9951 = 1.0;
        double r9952 = tan(r9944);
        double r9953 = r9944 - r9952;
        double r9954 = sin(r9944);
        double r9955 = r9944 - r9954;
        double r9956 = r9953 / r9955;
        double r9957 = r9951 / r9956;
        double r9958 = 0.225;
        double r9959 = 2.0;
        double r9960 = pow(r9944, r9959);
        double r9961 = r9958 * r9960;
        double r9962 = 0.009642857142857142;
        double r9963 = 4.0;
        double r9964 = pow(r9944, r9963);
        double r9965 = 0.5;
        double r9966 = fma(r9962, r9964, r9965);
        double r9967 = r9961 - r9966;
        double r9968 = r9950 ? r9957 : r9967;
        return r9968;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.02894118494710049 or 0.028078975194333212 < x

    1. Initial program 0.0

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

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

    if -0.02894118494710049 < x < 0.028078975194333212

    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)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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