Average Error: 31.6 → 0.0
Time: 22.2s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02780120038993252190584470895373669918627 \lor \neg \left(x \le 0.02674499741262323024293401374507084256038\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.02780120038993252190584470895373669918627 \lor \neg \left(x \le 0.02674499741262323024293401374507084256038\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 r29219 = x;
        double r29220 = sin(r29219);
        double r29221 = r29219 - r29220;
        double r29222 = tan(r29219);
        double r29223 = r29219 - r29222;
        double r29224 = r29221 / r29223;
        return r29224;
}

double f(double x) {
        double r29225 = x;
        double r29226 = -0.027801200389932522;
        bool r29227 = r29225 <= r29226;
        double r29228 = 0.02674499741262323;
        bool r29229 = r29225 <= r29228;
        double r29230 = !r29229;
        bool r29231 = r29227 || r29230;
        double r29232 = sin(r29225);
        double r29233 = r29225 - r29232;
        double r29234 = tan(r29225);
        double r29235 = r29225 - r29234;
        double r29236 = r29233 / r29235;
        double r29237 = 0.225;
        double r29238 = 2.0;
        double r29239 = pow(r29225, r29238);
        double r29240 = r29237 * r29239;
        double r29241 = 0.009642857142857142;
        double r29242 = 4.0;
        double r29243 = pow(r29225, r29242);
        double r29244 = r29241 * r29243;
        double r29245 = 0.5;
        double r29246 = r29244 + r29245;
        double r29247 = r29240 - r29246;
        double r29248 = r29231 ? r29236 : r29247;
        return r29248;
}

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.027801200389932522 or 0.02674499741262323 < x

    1. Initial program 0.0

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

    if -0.027801200389932522 < x < 0.02674499741262323

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