Average Error: 32.2 → 0.0
Time: 14.7s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02880168700527437758429627479017653968185 \lor \neg \left(x \le 0.0265338026812843158497301487841468770057\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.02880168700527437758429627479017653968185 \lor \neg \left(x \le 0.0265338026812843158497301487841468770057\right):\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

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

\end{array}
double f(double x) {
        double r12722 = x;
        double r12723 = sin(r12722);
        double r12724 = r12722 - r12723;
        double r12725 = tan(r12722);
        double r12726 = r12722 - r12725;
        double r12727 = r12724 / r12726;
        return r12727;
}

double f(double x) {
        double r12728 = x;
        double r12729 = -0.028801687005274378;
        bool r12730 = r12728 <= r12729;
        double r12731 = 0.026533802681284316;
        bool r12732 = r12728 <= r12731;
        double r12733 = !r12732;
        bool r12734 = r12730 || r12733;
        double r12735 = tan(r12728);
        double r12736 = r12728 - r12735;
        double r12737 = r12728 / r12736;
        double r12738 = sin(r12728);
        double r12739 = r12738 / r12736;
        double r12740 = r12737 - r12739;
        double r12741 = 0.225;
        double r12742 = 2.0;
        double r12743 = pow(r12728, r12742);
        double r12744 = r12741 * r12743;
        double r12745 = 0.009642857142857142;
        double r12746 = 4.0;
        double r12747 = pow(r12728, r12746);
        double r12748 = r12745 * r12747;
        double r12749 = r12744 - r12748;
        double r12750 = 0.5;
        double r12751 = r12749 - r12750;
        double r12752 = r12734 ? r12740 : r12751;
        return r12752;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -0.028801687005274378 or 0.026533802681284316 < x

    1. Initial program 0.0

      \[\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.028801687005274378 < x < 0.026533802681284316

    1. Initial program 63.4

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

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

Reproduce

herbie shell --seed 2019350 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))