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

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

\end{array}
double f(double x) {
        double r11525 = x;
        double r11526 = sin(r11525);
        double r11527 = r11525 - r11526;
        double r11528 = tan(r11525);
        double r11529 = r11525 - r11528;
        double r11530 = r11527 / r11529;
        return r11530;
}

double f(double x) {
        double r11531 = x;
        double r11532 = -0.030685173958992108;
        bool r11533 = r11531 <= r11532;
        double r11534 = 0.028993276489121412;
        bool r11535 = r11531 <= r11534;
        double r11536 = !r11535;
        bool r11537 = r11533 || r11536;
        double r11538 = tan(r11531);
        double r11539 = r11531 - r11538;
        double r11540 = r11531 / r11539;
        double r11541 = sin(r11531);
        double r11542 = r11541 / r11539;
        double r11543 = r11540 - r11542;
        double r11544 = 0.225;
        double r11545 = 2.0;
        double r11546 = pow(r11531, r11545);
        double r11547 = r11544 * r11546;
        double r11548 = 0.009642857142857142;
        double r11549 = 4.0;
        double r11550 = pow(r11531, r11549);
        double r11551 = r11548 * r11550;
        double r11552 = 0.5;
        double r11553 = r11551 + r11552;
        double r11554 = r11547 - r11553;
        double r11555 = r11537 ? r11543 : r11554;
        return r11555;
}

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.030685173958992108 or 0.028993276489121412 < x

    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.030685173958992108 < x < 0.028993276489121412

    1. Initial program 63.2

      \[\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. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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