Average Error: 31.9 → 0.0
Time: 23.8s
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 r554169 = x;
        double r554170 = sin(r554169);
        double r554171 = r554169 - r554170;
        double r554172 = tan(r554169);
        double r554173 = r554169 - r554172;
        double r554174 = r554171 / r554173;
        return r554174;
}

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

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))))