Average Error: 31.3 → 0.0
Time: 13.9s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0267757907687813344 \lor \neg \left(x \le 0.028698300516786159\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.0267757907687813344 \lor \neg \left(x \le 0.028698300516786159\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 r9110 = x;
        double r9111 = sin(r9110);
        double r9112 = r9110 - r9111;
        double r9113 = tan(r9110);
        double r9114 = r9110 - r9113;
        double r9115 = r9112 / r9114;
        return r9115;
}

double f(double x) {
        double r9116 = x;
        double r9117 = -0.026775790768781334;
        bool r9118 = r9116 <= r9117;
        double r9119 = 0.02869830051678616;
        bool r9120 = r9116 <= r9119;
        double r9121 = !r9120;
        bool r9122 = r9118 || r9121;
        double r9123 = sin(r9116);
        double r9124 = r9116 - r9123;
        double r9125 = tan(r9116);
        double r9126 = r9116 - r9125;
        double r9127 = r9124 / r9126;
        double r9128 = 0.225;
        double r9129 = 2.0;
        double r9130 = pow(r9116, r9129);
        double r9131 = r9128 * r9130;
        double r9132 = 0.009642857142857142;
        double r9133 = 4.0;
        double r9134 = pow(r9116, r9133);
        double r9135 = r9132 * r9134;
        double r9136 = 0.5;
        double r9137 = r9135 + r9136;
        double r9138 = r9131 - r9137;
        double r9139 = r9122 ? r9127 : r9138;
        return r9139;
}

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.026775790768781334 or 0.02869830051678616 < x

    1. Initial program 0.0

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

    if -0.026775790768781334 < x < 0.02869830051678616

    1. Initial program 63.3

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