Average Error: 31.5 → 0.0
Time: 33.0s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.027300092888257143:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.02472356942875851:\\ \;\;\;\;\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.027300092888257143:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\

\mathbf{elif}\;x \le 0.02472356942875851:\\
\;\;\;\;\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 r614326 = x;
        double r614327 = sin(r614326);
        double r614328 = r614326 - r614327;
        double r614329 = tan(r614326);
        double r614330 = r614326 - r614329;
        double r614331 = r614328 / r614330;
        return r614331;
}

double f(double x) {
        double r614332 = x;
        double r614333 = -0.027300092888257143;
        bool r614334 = r614332 <= r614333;
        double r614335 = sin(r614332);
        double r614336 = r614332 - r614335;
        double r614337 = tan(r614332);
        double r614338 = r614332 - r614337;
        double r614339 = r614336 / r614338;
        double r614340 = 0.02472356942875851;
        bool r614341 = r614332 <= r614340;
        double r614342 = 0.225;
        double r614343 = 0.009642857142857142;
        double r614344 = r614332 * r614332;
        double r614345 = r614343 * r614344;
        double r614346 = r614342 - r614345;
        double r614347 = r614346 * r614344;
        double r614348 = 0.5;
        double r614349 = r614347 - r614348;
        double r614350 = r614341 ? r614349 : r614339;
        double r614351 = r614334 ? r614339 : r614350;
        return r614351;
}

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.027300092888257143 or 0.02472356942875851 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]

    if -0.027300092888257143 < x < 0.02472356942875851

    1. Initial program 62.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.027300092888257143:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.02472356942875851:\\ \;\;\;\;\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 2019144 +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  (/ (- x (sin x)) (- x (tan x))))