Average Error: 31.9 → 0.0
Time: 24.1s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02911457298168511689806514652900659712031:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.02897311180941740046956844878422998590395:\\ \;\;\;\;\left(\frac{9}{40} \cdot \left(x \cdot x\right) - \left(\left(x \cdot x\right) \cdot \frac{27}{2800}\right) \cdot \left(x \cdot x\right)\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.02911457298168511689806514652900659712031:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

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

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

\end{array}
double f(double x) {
        double r554167 = x;
        double r554168 = sin(r554167);
        double r554169 = r554167 - r554168;
        double r554170 = tan(r554167);
        double r554171 = r554167 - r554170;
        double r554172 = r554169 / r554171;
        return r554172;
}

double f(double x) {
        double r554173 = x;
        double r554174 = -0.029114572981685117;
        bool r554175 = r554173 <= r554174;
        double r554176 = tan(r554173);
        double r554177 = r554173 - r554176;
        double r554178 = r554173 / r554177;
        double r554179 = sin(r554173);
        double r554180 = r554179 / r554177;
        double r554181 = r554178 - r554180;
        double r554182 = 0.0289731118094174;
        bool r554183 = r554173 <= r554182;
        double r554184 = 0.225;
        double r554185 = r554173 * r554173;
        double r554186 = r554184 * r554185;
        double r554187 = 0.009642857142857142;
        double r554188 = r554185 * r554187;
        double r554189 = r554188 * r554185;
        double r554190 = r554186 - r554189;
        double r554191 = -0.5;
        double r554192 = r554190 + r554191;
        double r554193 = r554173 - r554179;
        double r554194 = r554193 / r554177;
        double r554195 = r554183 ? r554192 : r554194;
        double r554196 = r554175 ? r554181 : r554195;
        return r554196;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if x < -0.029114572981685117

    1. Initial program 0.1

      \[\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.029114572981685117 < x < 0.0289731118094174

    1. Initial program 63.3

      \[\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(\frac{9}{40} \cdot \left(x \cdot x\right) - \left(\frac{27}{2800} \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) + \frac{-1}{2}}\]

    if 0.0289731118094174 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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