Average Error: 31.6 → 0.0
Time: 8.5s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.024514420160319003 \lor \neg \left(x \le 0.0285174389981211092\right):\\ \;\;\;\;\frac{x - \sin x}{x - \tan 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.024514420160319003 \lor \neg \left(x \le 0.0285174389981211092\right):\\
\;\;\;\;\frac{x - \sin x}{x - \tan 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 r7778 = x;
        double r7779 = sin(r7778);
        double r7780 = r7778 - r7779;
        double r7781 = tan(r7778);
        double r7782 = r7778 - r7781;
        double r7783 = r7780 / r7782;
        return r7783;
}

double f(double x) {
        double r7784 = x;
        double r7785 = -0.024514420160319003;
        bool r7786 = r7784 <= r7785;
        double r7787 = 0.02851743899812111;
        bool r7788 = r7784 <= r7787;
        double r7789 = !r7788;
        bool r7790 = r7786 || r7789;
        double r7791 = sin(r7784);
        double r7792 = r7784 - r7791;
        double r7793 = tan(r7784);
        double r7794 = r7784 - r7793;
        double r7795 = r7792 / r7794;
        double r7796 = 0.225;
        double r7797 = 2.0;
        double r7798 = pow(r7784, r7797);
        double r7799 = r7796 * r7798;
        double r7800 = 0.009642857142857142;
        double r7801 = 4.0;
        double r7802 = pow(r7784, r7801);
        double r7803 = r7800 * r7802;
        double r7804 = r7799 - r7803;
        double r7805 = 0.5;
        double r7806 = r7804 - r7805;
        double r7807 = r7790 ? r7795 : r7806;
        return r7807;
}

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.024514420160319003 or 0.02851743899812111 < x

    1. Initial program 0.1

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

    if -0.024514420160319003 < x < 0.02851743899812111

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