Average Error: 30.9 → 0.0
Time: 9.3s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0282266077727037941 \lor \neg \left(x \le 0.025407348733278587\right):\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.0282266077727037941 \lor \neg \left(x \le 0.025407348733278587\right):\\
\;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\

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

\end{array}
double f(double x) {
        double r11488 = x;
        double r11489 = sin(r11488);
        double r11490 = r11488 - r11489;
        double r11491 = tan(r11488);
        double r11492 = r11488 - r11491;
        double r11493 = r11490 / r11492;
        return r11493;
}

double f(double x) {
        double r11494 = x;
        double r11495 = -0.028226607772703794;
        bool r11496 = r11494 <= r11495;
        double r11497 = 0.025407348733278587;
        bool r11498 = r11494 <= r11497;
        double r11499 = !r11498;
        bool r11500 = r11496 || r11499;
        double r11501 = sin(r11494);
        double r11502 = r11494 - r11501;
        double r11503 = tan(r11494);
        double r11504 = r11494 - r11503;
        double r11505 = r11502 / r11504;
        double r11506 = exp(r11505);
        double r11507 = log(r11506);
        double r11508 = 0.225;
        double r11509 = 2.0;
        double r11510 = pow(r11494, r11509);
        double r11511 = r11508 * r11510;
        double r11512 = 0.009642857142857142;
        double r11513 = 4.0;
        double r11514 = pow(r11494, r11513);
        double r11515 = r11512 * r11514;
        double r11516 = r11511 - r11515;
        double r11517 = 0.5;
        double r11518 = r11516 - r11517;
        double r11519 = r11500 ? r11507 : r11518;
        return r11519;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -0.028226607772703794 or 0.025407348733278587 < 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)}\]

    if -0.028226607772703794 < x < 0.025407348733278587

    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. Using strategy rm
    4. Applied associate--r+0.0

      \[\leadsto \color{blue}{\left(\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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