Average Error: 31.3 → 0.0
Time: 12.5s
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 r7696 = x;
        double r7697 = sin(r7696);
        double r7698 = r7696 - r7697;
        double r7699 = tan(r7696);
        double r7700 = r7696 - r7699;
        double r7701 = r7698 / r7700;
        return r7701;
}

double f(double x) {
        double r7702 = x;
        double r7703 = -0.026775790768781334;
        bool r7704 = r7702 <= r7703;
        double r7705 = 0.02869830051678616;
        bool r7706 = r7702 <= r7705;
        double r7707 = !r7706;
        bool r7708 = r7704 || r7707;
        double r7709 = sin(r7702);
        double r7710 = r7702 - r7709;
        double r7711 = tan(r7702);
        double r7712 = r7702 - r7711;
        double r7713 = r7710 / r7712;
        double r7714 = 0.225;
        double r7715 = 2.0;
        double r7716 = pow(r7702, r7715);
        double r7717 = r7714 * r7716;
        double r7718 = 0.009642857142857142;
        double r7719 = 4.0;
        double r7720 = pow(r7702, r7719);
        double r7721 = r7718 * r7720;
        double r7722 = 0.5;
        double r7723 = r7721 + r7722;
        double r7724 = r7717 - r7723;
        double r7725 = r7708 ? r7713 : r7724;
        return r7725;
}

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