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

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

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

\end{array}
double f(double x) {
        double r754370 = x;
        double r754371 = sin(r754370);
        double r754372 = r754370 - r754371;
        double r754373 = tan(r754370);
        double r754374 = r754370 - r754373;
        double r754375 = r754372 / r754374;
        return r754375;
}

double f(double x) {
        double r754376 = x;
        double r754377 = -0.029656023299900573;
        bool r754378 = r754376 <= r754377;
        double r754379 = sin(r754376);
        double r754380 = r754376 - r754379;
        double r754381 = tan(r754376);
        double r754382 = r754376 - r754381;
        double r754383 = r754380 / r754382;
        double r754384 = 0.02964489669427243;
        bool r754385 = r754376 <= r754384;
        double r754386 = 0.225;
        double r754387 = 0.009642857142857142;
        double r754388 = r754376 * r754376;
        double r754389 = r754387 * r754388;
        double r754390 = r754386 - r754389;
        double r754391 = r754390 * r754388;
        double r754392 = 0.5;
        double r754393 = r754391 - r754392;
        double r754394 = r754385 ? r754393 : r754383;
        double r754395 = r754378 ? r754383 : r754394;
        return r754395;
}

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.029656023299900573 or 0.02964489669427243 < 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 sub-div0.0

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

    if -0.029656023299900573 < x < 0.02964489669427243

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

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

Reproduce

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