Average Error: 31.5 → 0.0
Time: 26.5s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0270579233257835539971924987412421614863 \lor \neg \left(x \le 0.03007487465186483091561520097911852644756\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan 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.0270579233257835539971924987412421614863 \lor \neg \left(x \le 0.03007487465186483091561520097911852644756\right):\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan 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 r23670 = x;
        double r23671 = sin(r23670);
        double r23672 = r23670 - r23671;
        double r23673 = tan(r23670);
        double r23674 = r23670 - r23673;
        double r23675 = r23672 / r23674;
        return r23675;
}

double f(double x) {
        double r23676 = x;
        double r23677 = -0.027057923325783554;
        bool r23678 = r23676 <= r23677;
        double r23679 = 0.03007487465186483;
        bool r23680 = r23676 <= r23679;
        double r23681 = !r23680;
        bool r23682 = r23678 || r23681;
        double r23683 = tan(r23676);
        double r23684 = r23676 - r23683;
        double r23685 = r23676 / r23684;
        double r23686 = sin(r23676);
        double r23687 = r23686 / r23684;
        double r23688 = r23685 - r23687;
        double r23689 = 0.225;
        double r23690 = 2.0;
        double r23691 = pow(r23676, r23690);
        double r23692 = r23689 * r23691;
        double r23693 = 0.009642857142857142;
        double r23694 = 4.0;
        double r23695 = pow(r23676, r23694);
        double r23696 = 0.5;
        double r23697 = fma(r23693, r23695, r23696);
        double r23698 = r23692 - r23697;
        double r23699 = r23682 ? r23688 : r23698;
        return r23699;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.027057923325783554 or 0.03007487465186483 < x

    1. Initial program 0.1

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

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

    if -0.027057923325783554 < x < 0.03007487465186483

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