Average Error: 31.1 → 0.0
Time: 22.8s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.03379760502135154692782137431095179636031 \lor \neg \left(x \le 0.02912871703929049635450887478782533435151\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.03379760502135154692782137431095179636031 \lor \neg \left(x \le 0.02912871703929049635450887478782533435151\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 r22684 = x;
        double r22685 = sin(r22684);
        double r22686 = r22684 - r22685;
        double r22687 = tan(r22684);
        double r22688 = r22684 - r22687;
        double r22689 = r22686 / r22688;
        return r22689;
}

double f(double x) {
        double r22690 = x;
        double r22691 = -0.03379760502135155;
        bool r22692 = r22690 <= r22691;
        double r22693 = 0.029128717039290496;
        bool r22694 = r22690 <= r22693;
        double r22695 = !r22694;
        bool r22696 = r22692 || r22695;
        double r22697 = tan(r22690);
        double r22698 = r22690 - r22697;
        double r22699 = r22690 / r22698;
        double r22700 = sin(r22690);
        double r22701 = r22700 / r22698;
        double r22702 = r22699 - r22701;
        double r22703 = 0.225;
        double r22704 = 2.0;
        double r22705 = pow(r22690, r22704);
        double r22706 = r22703 * r22705;
        double r22707 = 0.009642857142857142;
        double r22708 = 4.0;
        double r22709 = pow(r22690, r22708);
        double r22710 = r22707 * r22709;
        double r22711 = 0.5;
        double r22712 = r22710 + r22711;
        double r22713 = r22706 - r22712;
        double r22714 = r22696 ? r22702 : r22713;
        return r22714;
}

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.03379760502135155 or 0.029128717039290496 < 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.03379760502135155 < x < 0.029128717039290496

    1. Initial program 63.1

      \[\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.03379760502135154692782137431095179636031 \lor \neg \left(x \le 0.02912871703929049635450887478782533435151\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 2019209 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))