Average Error: 30.9 → 0.0
Time: 9.2s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02908084665988260389402064731712016509846 \lor \neg \left(x \le 0.03458526336808175755122007899444724898785\right):\\ \;\;\;\;\frac{x - \sin x}{x - \sin x \cdot \frac{1}{\cos x}}\\ \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.02908084665988260389402064731712016509846 \lor \neg \left(x \le 0.03458526336808175755122007899444724898785\right):\\
\;\;\;\;\frac{x - \sin x}{x - \sin x \cdot \frac{1}{\cos x}}\\

\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 r9606 = x;
        double r9607 = sin(r9606);
        double r9608 = r9606 - r9607;
        double r9609 = tan(r9606);
        double r9610 = r9606 - r9609;
        double r9611 = r9608 / r9610;
        return r9611;
}

double f(double x) {
        double r9612 = x;
        double r9613 = -0.029080846659882604;
        bool r9614 = r9612 <= r9613;
        double r9615 = 0.03458526336808176;
        bool r9616 = r9612 <= r9615;
        double r9617 = !r9616;
        bool r9618 = r9614 || r9617;
        double r9619 = sin(r9612);
        double r9620 = r9612 - r9619;
        double r9621 = 1.0;
        double r9622 = cos(r9612);
        double r9623 = r9621 / r9622;
        double r9624 = r9619 * r9623;
        double r9625 = r9612 - r9624;
        double r9626 = r9620 / r9625;
        double r9627 = 0.225;
        double r9628 = 2.0;
        double r9629 = pow(r9612, r9628);
        double r9630 = r9627 * r9629;
        double r9631 = 0.009642857142857142;
        double r9632 = 4.0;
        double r9633 = pow(r9612, r9632);
        double r9634 = r9631 * r9633;
        double r9635 = r9630 - r9634;
        double r9636 = 0.5;
        double r9637 = r9635 - r9636;
        double r9638 = r9618 ? r9626 : r9637;
        return r9638;
}

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.029080846659882604 or 0.03458526336808176 < x

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around inf 0.1

      \[\leadsto \frac{x - \sin x}{\color{blue}{x - \frac{\sin x}{\cos x}}}\]
    3. Using strategy rm
    4. Applied div-inv0.1

      \[\leadsto \frac{x - \sin x}{x - \color{blue}{\sin x \cdot \frac{1}{\cos x}}}\]

    if -0.029080846659882604 < x < 0.03458526336808176

    1. Initial program 62.9

      \[\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.02908084665988260389402064731712016509846 \lor \neg \left(x \le 0.03458526336808175755122007899444724898785\right):\\ \;\;\;\;\frac{x - \sin x}{x - \sin x \cdot \frac{1}{\cos x}}\\ \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 2019344 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))