Average Error: 30.8 → 0.0
Time: 26.2s
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 r748989 = x;
        double r748990 = sin(r748989);
        double r748991 = r748989 - r748990;
        double r748992 = tan(r748989);
        double r748993 = r748989 - r748992;
        double r748994 = r748991 / r748993;
        return r748994;
}

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

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