Average Error: 31.1 → 0.0
Time: 25.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 r21304 = x;
        double r21305 = sin(r21304);
        double r21306 = r21304 - r21305;
        double r21307 = tan(r21304);
        double r21308 = r21304 - r21307;
        double r21309 = r21306 / r21308;
        return r21309;
}

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

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