Average Error: 31.1 → 0.0
Time: 26.2s
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 r21320 = x;
        double r21321 = sin(r21320);
        double r21322 = r21320 - r21321;
        double r21323 = tan(r21320);
        double r21324 = r21320 - r21323;
        double r21325 = r21322 / r21324;
        return r21325;
}

double f(double x) {
        double r21326 = x;
        double r21327 = -0.029638169034640425;
        bool r21328 = r21326 <= r21327;
        double r21329 = tan(r21326);
        double r21330 = r21326 - r21329;
        double r21331 = r21326 / r21330;
        double r21332 = sin(r21326);
        double r21333 = r21332 / r21330;
        double r21334 = r21331 - r21333;
        double r21335 = 0.028662423939317287;
        bool r21336 = r21326 <= r21335;
        double r21337 = 0.225;
        double r21338 = 2.0;
        double r21339 = pow(r21326, r21338);
        double r21340 = r21337 * r21339;
        double r21341 = 0.009642857142857142;
        double r21342 = 4.0;
        double r21343 = pow(r21326, r21342);
        double r21344 = r21341 * r21343;
        double r21345 = 0.5;
        double r21346 = r21344 + r21345;
        double r21347 = r21340 - r21346;
        double r21348 = r21326 - r21332;
        double r21349 = r21348 / r21330;
        double r21350 = exp(r21349);
        double r21351 = log(r21350);
        double r21352 = r21336 ? r21347 : r21351;
        double r21353 = r21328 ? r21334 : r21352;
        return r21353;
}

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