Average Error: 30.9 → 0.0
Time: 9.4s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.030514642582300338:\\ \;\;\;\;\frac{x - \sin x}{x - \frac{\sin x}{\cos x}}\\ \mathbf{elif}\;x \le 0.0319715048145489053:\\ \;\;\;\;\left(\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.030514642582300338:\\
\;\;\;\;\frac{x - \sin x}{x - \frac{\sin x}{\cos x}}\\

\mathbf{elif}\;x \le 0.0319715048145489053:\\
\;\;\;\;\left(\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

\end{array}
double f(double x) {
        double r11968 = x;
        double r11969 = sin(r11968);
        double r11970 = r11968 - r11969;
        double r11971 = tan(r11968);
        double r11972 = r11968 - r11971;
        double r11973 = r11970 / r11972;
        return r11973;
}

double f(double x) {
        double r11974 = x;
        double r11975 = -0.030514642582300338;
        bool r11976 = r11974 <= r11975;
        double r11977 = sin(r11974);
        double r11978 = r11974 - r11977;
        double r11979 = cos(r11974);
        double r11980 = r11977 / r11979;
        double r11981 = r11974 - r11980;
        double r11982 = r11978 / r11981;
        double r11983 = 0.031971504814548905;
        bool r11984 = r11974 <= r11983;
        double r11985 = 0.225;
        double r11986 = 2.0;
        double r11987 = pow(r11974, r11986);
        double r11988 = r11985 * r11987;
        double r11989 = 0.009642857142857142;
        double r11990 = 4.0;
        double r11991 = pow(r11974, r11990);
        double r11992 = r11989 * r11991;
        double r11993 = r11988 - r11992;
        double r11994 = 0.5;
        double r11995 = r11993 - r11994;
        double r11996 = tan(r11974);
        double r11997 = r11974 - r11996;
        double r11998 = r11974 / r11997;
        double r11999 = r11977 / r11997;
        double r12000 = r11998 - r11999;
        double r12001 = r11984 ? r11995 : r12000;
        double r12002 = r11976 ? r11982 : r12001;
        return r12002;
}

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

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around inf 0.1

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

    if -0.030514642582300338 < x < 0.031971504814548905

    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. Using strategy rm
    4. Applied associate--r+0.0

      \[\leadsto \color{blue}{\left(\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}}\]

    if 0.031971504814548905 < 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}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.030514642582300338:\\ \;\;\;\;\frac{x - \sin x}{x - \frac{\sin x}{\cos x}}\\ \mathbf{elif}\;x \le 0.0319715048145489053:\\ \;\;\;\;\left(\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \end{array}\]

Reproduce

herbie shell --seed 2020049 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))