Average Error: 31.5 → 0.0
Time: 21.6s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.03059660473543995840017828413692768663168:\\ \;\;\;\;\frac{x - \sin x}{x - \frac{\sin x}{\cos x}}\\ \mathbf{elif}\;x \le 0.02826990227262924509910035908433201257139:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \left(\log \left(e^{\frac{27}{2800} \cdot {x}^{4}}\right) + \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.03059660473543995840017828413692768663168:\\
\;\;\;\;\frac{x - \sin x}{x - \frac{\sin x}{\cos x}}\\

\mathbf{elif}\;x \le 0.02826990227262924509910035908433201257139:\\
\;\;\;\;\frac{9}{40} \cdot {x}^{2} - \left(\log \left(e^{\frac{27}{2800} \cdot {x}^{4}}\right) + \frac{1}{2}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

\end{array}
double f(double x) {
        double r20744 = x;
        double r20745 = sin(r20744);
        double r20746 = r20744 - r20745;
        double r20747 = tan(r20744);
        double r20748 = r20744 - r20747;
        double r20749 = r20746 / r20748;
        return r20749;
}

double f(double x) {
        double r20750 = x;
        double r20751 = -0.03059660473543996;
        bool r20752 = r20750 <= r20751;
        double r20753 = sin(r20750);
        double r20754 = r20750 - r20753;
        double r20755 = cos(r20750);
        double r20756 = r20753 / r20755;
        double r20757 = r20750 - r20756;
        double r20758 = r20754 / r20757;
        double r20759 = 0.028269902272629245;
        bool r20760 = r20750 <= r20759;
        double r20761 = 0.225;
        double r20762 = 2.0;
        double r20763 = pow(r20750, r20762);
        double r20764 = r20761 * r20763;
        double r20765 = 0.009642857142857142;
        double r20766 = 4.0;
        double r20767 = pow(r20750, r20766);
        double r20768 = r20765 * r20767;
        double r20769 = exp(r20768);
        double r20770 = log(r20769);
        double r20771 = 0.5;
        double r20772 = r20770 + r20771;
        double r20773 = r20764 - r20772;
        double r20774 = tan(r20750);
        double r20775 = r20750 - r20774;
        double r20776 = r20750 / r20775;
        double r20777 = r20753 / r20775;
        double r20778 = r20776 - r20777;
        double r20779 = r20760 ? r20773 : r20778;
        double r20780 = r20752 ? r20758 : r20779;
        return r20780;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if x < -0.03059660473543996

    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}}}\]

    if -0.03059660473543996 < x < 0.028269902272629245

    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. Using strategy rm
    4. Applied add-log-exp0.0

      \[\leadsto \frac{9}{40} \cdot {x}^{2} - \left(\color{blue}{\log \left(e^{\frac{27}{2800} \cdot {x}^{4}}\right)} + \frac{1}{2}\right)\]

    if 0.028269902272629245 < 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}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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