Average Error: 31.4 → 0.0
Time: 9.9s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02679764477988002754904606206309836125001 \lor \neg \left(x \le 0.02671164277294657204975258935064630350098\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\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.02679764477988002754904606206309836125001 \lor \neg \left(x \le 0.02671164277294657204975258935064630350098\right):\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\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 r14023 = x;
        double r14024 = sin(r14023);
        double r14025 = r14023 - r14024;
        double r14026 = tan(r14023);
        double r14027 = r14023 - r14026;
        double r14028 = r14025 / r14027;
        return r14028;
}

double f(double x) {
        double r14029 = x;
        double r14030 = -0.026797644779880028;
        bool r14031 = r14029 <= r14030;
        double r14032 = 0.026711642772946572;
        bool r14033 = r14029 <= r14032;
        double r14034 = !r14033;
        bool r14035 = r14031 || r14034;
        double r14036 = tan(r14029);
        double r14037 = r14029 - r14036;
        double r14038 = r14029 / r14037;
        double r14039 = sin(r14029);
        double r14040 = r14039 / r14037;
        double r14041 = r14038 - r14040;
        double r14042 = 0.225;
        double r14043 = 2.0;
        double r14044 = pow(r14029, r14043);
        double r14045 = r14042 * r14044;
        double r14046 = 0.009642857142857142;
        double r14047 = 4.0;
        double r14048 = pow(r14029, r14047);
        double r14049 = r14046 * r14048;
        double r14050 = 0.5;
        double r14051 = r14049 + r14050;
        double r14052 = r14045 - r14051;
        double r14053 = r14035 ? r14041 : r14052;
        return r14053;
}

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.026797644779880028 or 0.026711642772946572 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub0.1

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

    if -0.026797644779880028 < x < 0.026711642772946572

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