Average Error: 31.4 → 0.0
Time: 22.7s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.029152232486199241 \lor \neg \left(x \le 0.0281843105629446845\right):\\ \;\;\;\;\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}\right)}\\ \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.029152232486199241 \lor \neg \left(x \le 0.0281843105629446845\right):\\
\;\;\;\;\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}\right)}\\

\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 r21580 = x;
        double r21581 = sin(r21580);
        double r21582 = r21580 - r21581;
        double r21583 = tan(r21580);
        double r21584 = r21580 - r21583;
        double r21585 = r21582 / r21584;
        return r21585;
}

double f(double x) {
        double r21586 = x;
        double r21587 = -0.02915223248619924;
        bool r21588 = r21586 <= r21587;
        double r21589 = 0.028184310562944685;
        bool r21590 = r21586 <= r21589;
        double r21591 = !r21590;
        bool r21592 = r21588 || r21591;
        double r21593 = tan(r21586);
        double r21594 = r21586 - r21593;
        double r21595 = r21586 / r21594;
        double r21596 = 3.0;
        double r21597 = pow(r21595, r21596);
        double r21598 = sin(r21586);
        double r21599 = r21598 / r21594;
        double r21600 = pow(r21599, r21596);
        double r21601 = r21597 - r21600;
        double r21602 = r21595 * r21595;
        double r21603 = r21595 + r21599;
        double r21604 = r21599 * r21603;
        double r21605 = r21602 + r21604;
        double r21606 = r21601 / r21605;
        double r21607 = 0.225;
        double r21608 = 2.0;
        double r21609 = pow(r21586, r21608);
        double r21610 = r21607 * r21609;
        double r21611 = 0.009642857142857142;
        double r21612 = 4.0;
        double r21613 = pow(r21586, r21612);
        double r21614 = r21611 * r21613;
        double r21615 = r21610 - r21614;
        double r21616 = 0.5;
        double r21617 = r21615 - r21616;
        double r21618 = r21592 ? r21606 : r21617;
        return r21618;
}

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.02915223248619924 or 0.028184310562944685 < x

    1. Initial program 0.0

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

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
    4. Using strategy rm
    5. Applied flip3--0.1

      \[\leadsto \color{blue}{\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \left(\frac{\sin x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x} + \frac{x}{x - \tan x} \cdot \frac{\sin x}{x - \tan x}\right)}}\]
    6. Simplified0.1

      \[\leadsto \frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\color{blue}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}\right)}}\]

    if -0.02915223248619924 < x < 0.028184310562944685

    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. 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.029152232486199241 \lor \neg \left(x \le 0.0281843105629446845\right):\\ \;\;\;\;\frac{{\left(\frac{x}{x - \tan x}\right)}^{3} - {\left(\frac{\sin x}{x - \tan x}\right)}^{3}}{\frac{x}{x - \tan x} \cdot \frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x} \cdot \left(\frac{x}{x - \tan x} + \frac{\sin x}{x - \tan x}\right)}\\ \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 2019198 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  (/ (- x (sin x)) (- x (tan x))))