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

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

\end{array}
double f(double x) {
        double r14519 = x;
        double r14520 = sin(r14519);
        double r14521 = r14519 - r14520;
        double r14522 = tan(r14519);
        double r14523 = r14519 - r14522;
        double r14524 = r14521 / r14523;
        return r14524;
}

double f(double x) {
        double r14525 = x;
        double r14526 = -0.026797644779880028;
        bool r14527 = r14525 <= r14526;
        double r14528 = 0.026711642772946572;
        bool r14529 = r14525 <= r14528;
        double r14530 = !r14529;
        bool r14531 = r14527 || r14530;
        double r14532 = tan(r14525);
        double r14533 = r14525 - r14532;
        double r14534 = r14525 / r14533;
        double r14535 = sin(r14525);
        double r14536 = r14535 / r14533;
        double r14537 = r14534 - r14536;
        double r14538 = 0.225;
        double r14539 = 2.0;
        double r14540 = pow(r14525, r14539);
        double r14541 = r14538 * r14540;
        double r14542 = 0.009642857142857142;
        double r14543 = 4.0;
        double r14544 = pow(r14525, r14543);
        double r14545 = r14542 * r14544;
        double r14546 = 0.5;
        double r14547 = r14545 + r14546;
        double r14548 = r14541 - r14547;
        double r14549 = r14531 ? r14537 : r14548;
        return r14549;
}

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.026797644779880028 or 0.026711642772946572 < 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.026797644779880028 < x < 0.026711642772946572

    1. Initial program 63.3

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

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

Reproduce

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