Average Error: 31.1 → 0.0
Time: 26.9s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02963816903464042487592600139123533153906:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.02866242393931728651979007338468363741413:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.02963816903464042487592600139123533153906:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

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

\mathbf{else}:\\
\;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\

\end{array}
double f(double x) {
        double r21309 = x;
        double r21310 = sin(r21309);
        double r21311 = r21309 - r21310;
        double r21312 = tan(r21309);
        double r21313 = r21309 - r21312;
        double r21314 = r21311 / r21313;
        return r21314;
}

double f(double x) {
        double r21315 = x;
        double r21316 = -0.029638169034640425;
        bool r21317 = r21315 <= r21316;
        double r21318 = tan(r21315);
        double r21319 = r21315 - r21318;
        double r21320 = r21315 / r21319;
        double r21321 = sin(r21315);
        double r21322 = r21321 / r21319;
        double r21323 = r21320 - r21322;
        double r21324 = 0.028662423939317287;
        bool r21325 = r21315 <= r21324;
        double r21326 = 0.225;
        double r21327 = 2.0;
        double r21328 = pow(r21315, r21327);
        double r21329 = r21326 * r21328;
        double r21330 = 0.009642857142857142;
        double r21331 = 4.0;
        double r21332 = pow(r21315, r21331);
        double r21333 = r21330 * r21332;
        double r21334 = 0.5;
        double r21335 = r21333 + r21334;
        double r21336 = r21329 - r21335;
        double r21337 = r21315 - r21321;
        double r21338 = r21337 / r21319;
        double r21339 = exp(r21338);
        double r21340 = log(r21339);
        double r21341 = r21325 ? r21336 : r21340;
        double r21342 = r21317 ? r21323 : r21341;
        return r21342;
}

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.029638169034640425

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub0.0

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]

    if -0.029638169034640425 < x < 0.028662423939317287

    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)}\]

    if 0.028662423939317287 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-log-exp0.0

      \[\leadsto \color{blue}{\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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