Average Error: 31.3 → 0.0
Time: 18.8s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02908178396942001989189385824374767253175 \lor \neg \left(x \le 0.03214934687220063341817066771000099834055\right):\\ \;\;\;\;\frac{x - \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.02908178396942001989189385824374767253175 \lor \neg \left(x \le 0.03214934687220063341817066771000099834055\right):\\
\;\;\;\;\frac{x - \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 r14694 = x;
        double r14695 = sin(r14694);
        double r14696 = r14694 - r14695;
        double r14697 = tan(r14694);
        double r14698 = r14694 - r14697;
        double r14699 = r14696 / r14698;
        return r14699;
}

double f(double x) {
        double r14700 = x;
        double r14701 = -0.02908178396942002;
        bool r14702 = r14700 <= r14701;
        double r14703 = 0.03214934687220063;
        bool r14704 = r14700 <= r14703;
        double r14705 = !r14704;
        bool r14706 = r14702 || r14705;
        double r14707 = sin(r14700);
        double r14708 = r14700 - r14707;
        double r14709 = tan(r14700);
        double r14710 = r14700 - r14709;
        double r14711 = r14708 / r14710;
        double r14712 = 0.225;
        double r14713 = 2.0;
        double r14714 = pow(r14700, r14713);
        double r14715 = r14712 * r14714;
        double r14716 = 0.009642857142857142;
        double r14717 = 4.0;
        double r14718 = pow(r14700, r14717);
        double r14719 = r14716 * r14718;
        double r14720 = 0.5;
        double r14721 = r14719 + r14720;
        double r14722 = r14715 - r14721;
        double r14723 = r14706 ? r14711 : r14722;
        return r14723;
}

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.02908178396942002 or 0.03214934687220063 < x

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]

    if -0.02908178396942002 < x < 0.03214934687220063

    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.02908178396942001989189385824374767253175 \lor \neg \left(x \le 0.03214934687220063341817066771000099834055\right):\\ \;\;\;\;\frac{x - \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 2019212 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))