Average Error: 30.9 → 0.0
Time: 29.7s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.028213729881585915:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.031240215431948184:\\ \;\;\;\;\left(\left(x \cdot x\right) \cdot \frac{9}{40} - \frac{1}{2}\right) - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.028213729881585915:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

\mathbf{elif}\;x \le 0.031240215431948184:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot \frac{9}{40} - \frac{1}{2}\right) - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

\end{array}
double f(double x) {
        double r335610 = x;
        double r335611 = sin(r335610);
        double r335612 = r335610 - r335611;
        double r335613 = tan(r335610);
        double r335614 = r335610 - r335613;
        double r335615 = r335612 / r335614;
        return r335615;
}

double f(double x) {
        double r335616 = x;
        double r335617 = -0.028213729881585915;
        bool r335618 = r335616 <= r335617;
        double r335619 = tan(r335616);
        double r335620 = r335616 - r335619;
        double r335621 = r335616 / r335620;
        double r335622 = sin(r335616);
        double r335623 = r335622 / r335620;
        double r335624 = r335621 - r335623;
        double r335625 = 0.031240215431948184;
        bool r335626 = r335616 <= r335625;
        double r335627 = r335616 * r335616;
        double r335628 = 0.225;
        double r335629 = r335627 * r335628;
        double r335630 = 0.5;
        double r335631 = r335629 - r335630;
        double r335632 = r335627 * r335627;
        double r335633 = 0.009642857142857142;
        double r335634 = r335632 * r335633;
        double r335635 = r335631 - r335634;
        double r335636 = r335626 ? r335635 : r335624;
        double r335637 = r335618 ? r335624 : r335636;
        return r335637;
}

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.028213729881585915 or 0.031240215431948184 < 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.028213729881585915 < x < 0.031240215431948184

    1. Initial program 62.8

      \[\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}{\left(\left(x \cdot x\right) \cdot \frac{9}{40} - \frac{1}{2}\right) - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.028213729881585915:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.031240215431948184:\\ \;\;\;\;\left(\left(x \cdot x\right) \cdot \frac{9}{40} - \frac{1}{2}\right) - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \frac{27}{2800}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \end{array}\]

Reproduce

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