Average Error: 31.4 → 0.0
Time: 38.9s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0328281005146998:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.02658761844916455:\\ \;\;\;\;\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.0328281005146998:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\

\mathbf{elif}\;x \le 0.02658761844916455:\\
\;\;\;\;\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 r488284 = x;
        double r488285 = sin(r488284);
        double r488286 = r488284 - r488285;
        double r488287 = tan(r488284);
        double r488288 = r488284 - r488287;
        double r488289 = r488286 / r488288;
        return r488289;
}

double f(double x) {
        double r488290 = x;
        double r488291 = -0.0328281005146998;
        bool r488292 = r488290 <= r488291;
        double r488293 = sin(r488290);
        double r488294 = r488290 - r488293;
        double r488295 = tan(r488290);
        double r488296 = r488290 - r488295;
        double r488297 = r488294 / r488296;
        double r488298 = 0.02658761844916455;
        bool r488299 = r488290 <= r488298;
        double r488300 = 0.225;
        double r488301 = 0.009642857142857142;
        double r488302 = r488290 * r488290;
        double r488303 = r488301 * r488302;
        double r488304 = r488300 - r488303;
        double r488305 = r488304 * r488302;
        double r488306 = 0.5;
        double r488307 = r488305 - r488306;
        double r488308 = r488299 ? r488307 : r488297;
        double r488309 = r488292 ? r488297 : r488308;
        return r488309;
}

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.0328281005146998 or 0.02658761844916455 < x

    1. Initial program 0.0

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

    if -0.0328281005146998 < x < 0.02658761844916455

    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.0328281005146998:\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.02658761844916455:\\ \;\;\;\;\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 2019146 +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  (/ (- x (sin x)) (- x (tan x))))