Average Error: 31.3 → 0.0
Time: 16.7s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0275654979361482401 \lor \neg \left(x \le 0.029125046562482146\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.0275654979361482401 \lor \neg \left(x \le 0.029125046562482146\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 r14701 = x;
        double r14702 = sin(r14701);
        double r14703 = r14701 - r14702;
        double r14704 = tan(r14701);
        double r14705 = r14701 - r14704;
        double r14706 = r14703 / r14705;
        return r14706;
}

double f(double x) {
        double r14707 = x;
        double r14708 = -0.02756549793614824;
        bool r14709 = r14707 <= r14708;
        double r14710 = 0.029125046562482146;
        bool r14711 = r14707 <= r14710;
        double r14712 = !r14711;
        bool r14713 = r14709 || r14712;
        double r14714 = 1.0;
        double r14715 = tan(r14707);
        double r14716 = r14707 - r14715;
        double r14717 = sin(r14707);
        double r14718 = r14707 - r14717;
        double r14719 = r14716 / r14718;
        double r14720 = r14714 / r14719;
        double r14721 = 0.225;
        double r14722 = 2.0;
        double r14723 = pow(r14707, r14722);
        double r14724 = r14721 * r14723;
        double r14725 = 0.009642857142857142;
        double r14726 = 4.0;
        double r14727 = pow(r14707, r14726);
        double r14728 = 0.5;
        double r14729 = fma(r14725, r14727, r14728);
        double r14730 = r14724 - r14729;
        double r14731 = r14713 ? r14720 : r14730;
        return r14731;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.02756549793614824 or 0.029125046562482146 < 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.02756549793614824 < x < 0.029125046562482146

    1. Initial program 63.0

      \[\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.0275654979361482401 \lor \neg \left(x \le 0.029125046562482146\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 2020045 +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))