Average Error: 31.4 → 0.0
Time: 28.0s
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 r438211 = x;
        double r438212 = sin(r438211);
        double r438213 = r438211 - r438212;
        double r438214 = tan(r438211);
        double r438215 = r438211 - r438214;
        double r438216 = r438213 / r438215;
        return r438216;
}

double f(double x) {
        double r438217 = x;
        double r438218 = -0.0328281005146998;
        bool r438219 = r438217 <= r438218;
        double r438220 = sin(r438217);
        double r438221 = r438217 - r438220;
        double r438222 = tan(r438217);
        double r438223 = r438217 - r438222;
        double r438224 = r438221 / r438223;
        double r438225 = 0.02658761844916455;
        bool r438226 = r438217 <= r438225;
        double r438227 = 0.225;
        double r438228 = 0.009642857142857142;
        double r438229 = r438217 * r438217;
        double r438230 = r438228 * r438229;
        double r438231 = r438227 - r438230;
        double r438232 = r438231 * r438229;
        double r438233 = 0.5;
        double r438234 = r438232 - r438233;
        double r438235 = r438226 ? r438234 : r438224;
        double r438236 = r438219 ? r438224 : r438235;
        return r438236;
}

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 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  (/ (- x (sin x)) (- x (tan x))))