Average Error: 30.8 → 0.0
Time: 29.1s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.027836888459983777:\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \mathbf{elif}\;x \le 0.02825639784178301:\\ \;\;\;\;\left(\left(x \cdot x\right) \cdot \frac{9}{40} - \left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \frac{27}{2800}\right)\right) - \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.027836888459983777:\\
\;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\

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

\mathbf{else}:\\
\;\;\;\;\log \left(e^{\frac{x - \sin x}{x - \tan x}}\right)\\

\end{array}
double f(double x) {
        double r748986 = x;
        double r748987 = sin(r748986);
        double r748988 = r748986 - r748987;
        double r748989 = tan(r748986);
        double r748990 = r748986 - r748989;
        double r748991 = r748988 / r748990;
        return r748991;
}

double f(double x) {
        double r748992 = x;
        double r748993 = -0.027836888459983777;
        bool r748994 = r748992 <= r748993;
        double r748995 = sin(r748992);
        double r748996 = r748992 - r748995;
        double r748997 = tan(r748992);
        double r748998 = r748992 - r748997;
        double r748999 = r748996 / r748998;
        double r749000 = exp(r748999);
        double r749001 = log(r749000);
        double r749002 = 0.02825639784178301;
        bool r749003 = r748992 <= r749002;
        double r749004 = r748992 * r748992;
        double r749005 = 0.225;
        double r749006 = r749004 * r749005;
        double r749007 = 0.009642857142857142;
        double r749008 = r749004 * r749007;
        double r749009 = r749004 * r749008;
        double r749010 = r749006 - r749009;
        double r749011 = 0.5;
        double r749012 = r749010 - r749011;
        double r749013 = r749003 ? r749012 : r749001;
        double r749014 = r748994 ? r749001 : r749013;
        return r749014;
}

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.027836888459983777 or 0.02825639784178301 < 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)}\]

    if -0.027836888459983777 < x < 0.02825639784178301

    1. Initial program 62.8

      \[\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. Simplified0.0

      \[\leadsto \color{blue}{\left(\frac{9}{40} \cdot \left(x \cdot x\right) - \left(\frac{27}{2800} \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) - \frac{1}{2}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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