Average Error: 31.4 → 0.0
Time: 26.3s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.03460187503695808658443766603340918663889 \lor \neg \left(x \le 0.02971674690753507361296037458942009834573\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.03460187503695808658443766603340918663889 \lor \neg \left(x \le 0.02971674690753507361296037458942009834573\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 r22605 = x;
        double r22606 = sin(r22605);
        double r22607 = r22605 - r22606;
        double r22608 = tan(r22605);
        double r22609 = r22605 - r22608;
        double r22610 = r22607 / r22609;
        return r22610;
}

double f(double x) {
        double r22611 = x;
        double r22612 = -0.03460187503695809;
        bool r22613 = r22611 <= r22612;
        double r22614 = 0.029716746907535074;
        bool r22615 = r22611 <= r22614;
        double r22616 = !r22615;
        bool r22617 = r22613 || r22616;
        double r22618 = sin(r22611);
        double r22619 = r22611 - r22618;
        double r22620 = tan(r22611);
        double r22621 = r22611 - r22620;
        double r22622 = r22619 / r22621;
        double r22623 = 0.225;
        double r22624 = 2.0;
        double r22625 = pow(r22611, r22624);
        double r22626 = r22623 * r22625;
        double r22627 = 0.009642857142857142;
        double r22628 = 4.0;
        double r22629 = pow(r22611, r22628);
        double r22630 = r22627 * r22629;
        double r22631 = 0.5;
        double r22632 = r22630 + r22631;
        double r22633 = r22626 - r22632;
        double r22634 = r22617 ? r22622 : r22633;
        return r22634;
}

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.03460187503695809

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-log-exp0.1

      \[\leadsto \color{blue}{\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)}\]
    4. Using strategy rm
    5. Applied div-sub0.1

      \[\leadsto \log \left(e^{\color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}}\right)\]
    6. Applied exp-diff0.1

      \[\leadsto \log \color{blue}{\left(\frac{e^{\frac{x}{x - \tan x}}}{e^{\frac{\sin x}{x - \tan x}}}\right)}\]
    7. Applied log-div0.1

      \[\leadsto \color{blue}{\log \left(e^{\frac{x}{x - \tan x}}\right) - \log \left(e^{\frac{\sin x}{x - \tan x}}\right)}\]
    8. Simplified0.1

      \[\leadsto \color{blue}{\frac{x}{x - \tan x}} - \log \left(e^{\frac{\sin x}{x - \tan x}}\right)\]
    9. Simplified0.1

      \[\leadsto \frac{x}{x - \tan x} - \color{blue}{\frac{\sin x}{x - \tan x}}\]

    if -0.03460187503695809 < x < 0.029716746907535074

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

    if 0.029716746907535074 < x

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-log-exp0.1

      \[\leadsto \color{blue}{\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.03460187503695808658443766603340918663889 \lor \neg \left(x \le 0.02971674690753507361296037458942009834573\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 2019291 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))