Average Error: 31.6 → 0.0
Time: 11.1s
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 r20608 = x;
        double r20609 = sin(r20608);
        double r20610 = r20608 - r20609;
        double r20611 = tan(r20608);
        double r20612 = r20608 - r20611;
        double r20613 = r20610 / r20612;
        return r20613;
}

double f(double x) {
        double r20614 = x;
        double r20615 = -0.027801200389932522;
        bool r20616 = r20614 <= r20615;
        double r20617 = 0.02674499741262323;
        bool r20618 = r20614 <= r20617;
        double r20619 = !r20618;
        bool r20620 = r20616 || r20619;
        double r20621 = sin(r20614);
        double r20622 = r20614 - r20621;
        double r20623 = tan(r20614);
        double r20624 = r20614 - r20623;
        double r20625 = r20622 / r20624;
        double r20626 = 0.225;
        double r20627 = 2.0;
        double r20628 = pow(r20614, r20627);
        double r20629 = r20626 * r20628;
        double r20630 = 0.009642857142857142;
        double r20631 = 4.0;
        double r20632 = pow(r20614, r20631);
        double r20633 = r20630 * r20632;
        double r20634 = 0.5;
        double r20635 = r20633 + r20634;
        double r20636 = r20629 - r20635;
        double r20637 = r20620 ? r20625 : r20636;
        return r20637;
}

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))))