Average Error: 31.5 → 0.1
Time: 10.4s
Precision: 64
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.0300408862856716037:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 2.5070089716143773:\\ \;\;\;\;\left(\frac{9}{40} \cdot {x}^{2} - \log \left(\sqrt{e^{\frac{27}{2800} \cdot {x}^{4}}}\right)\right) - \left(\log \left(\sqrt{e^{\frac{27}{2800} \cdot {x}^{4}}}\right) + \frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sin x}{x \cdot \cos x} + \left(\frac{{\left(\sin x\right)}^{2}}{{x}^{2} \cdot {\left(\cos x\right)}^{2}} + 1\right)\right) - \left(\frac{\sin x}{x} + \frac{{\left(\sin x\right)}^{2}}{{x}^{2} \cdot \cos x}\right)\\ \end{array}\]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \le -0.0300408862856716037:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\

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

\mathbf{else}:\\
\;\;\;\;\left(\frac{\sin x}{x \cdot \cos x} + \left(\frac{{\left(\sin x\right)}^{2}}{{x}^{2} \cdot {\left(\cos x\right)}^{2}} + 1\right)\right) - \left(\frac{\sin x}{x} + \frac{{\left(\sin x\right)}^{2}}{{x}^{2} \cdot \cos x}\right)\\

\end{array}
double code(double x) {
	return ((double) (((double) (x - ((double) sin(x)))) / ((double) (x - ((double) tan(x))))));
}
double code(double x) {
	double VAR;
	if ((x <= -0.030040886285671604)) {
		VAR = ((double) (((double) (x / ((double) (x - ((double) tan(x)))))) - ((double) (((double) sin(x)) / ((double) (x - ((double) tan(x))))))));
	} else {
		double VAR_1;
		if ((x <= 2.5070089716143773)) {
			VAR_1 = ((double) (((double) (((double) (0.225 * ((double) pow(x, 2.0)))) - ((double) log(((double) sqrt(((double) exp(((double) (0.009642857142857142 * ((double) pow(x, 4.0)))))))))))) - ((double) (((double) log(((double) sqrt(((double) exp(((double) (0.009642857142857142 * ((double) pow(x, 4.0)))))))))) + 0.5))));
		} else {
			VAR_1 = ((double) (((double) (((double) (((double) sin(x)) / ((double) (x * ((double) cos(x)))))) + ((double) (((double) (((double) pow(((double) sin(x)), 2.0)) / ((double) (((double) pow(x, 2.0)) * ((double) pow(((double) cos(x)), 2.0)))))) + 1.0)))) - ((double) (((double) (((double) sin(x)) / x)) + ((double) (((double) pow(((double) sin(x)), 2.0)) / ((double) (((double) pow(x, 2.0)) * ((double) cos(x))))))))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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

    1. Initial program 0.0

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

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

    if -0.030040886285671604 < x < 2.5070089716143773

    1. Initial program 63.0

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

      \[\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 add-log-exp0.1

      \[\leadsto \frac{9}{40} \cdot {x}^{2} - \left(\color{blue}{\log \left(e^{\frac{27}{2800} \cdot {x}^{4}}\right)} + \frac{1}{2}\right)\]
    5. Using strategy rm
    6. Applied add-sqr-sqrt0.1

      \[\leadsto \frac{9}{40} \cdot {x}^{2} - \left(\log \color{blue}{\left(\sqrt{e^{\frac{27}{2800} \cdot {x}^{4}}} \cdot \sqrt{e^{\frac{27}{2800} \cdot {x}^{4}}}\right)} + \frac{1}{2}\right)\]
    7. Applied log-prod0.1

      \[\leadsto \frac{9}{40} \cdot {x}^{2} - \left(\color{blue}{\left(\log \left(\sqrt{e^{\frac{27}{2800} \cdot {x}^{4}}}\right) + \log \left(\sqrt{e^{\frac{27}{2800} \cdot {x}^{4}}}\right)\right)} + \frac{1}{2}\right)\]
    8. Applied associate-+l+0.1

      \[\leadsto \frac{9}{40} \cdot {x}^{2} - \color{blue}{\left(\log \left(\sqrt{e^{\frac{27}{2800} \cdot {x}^{4}}}\right) + \left(\log \left(\sqrt{e^{\frac{27}{2800} \cdot {x}^{4}}}\right) + \frac{1}{2}\right)\right)}\]
    9. Applied associate--r+0.1

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

    if 2.5070089716143773 < x

    1. Initial program 0.0

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

      \[\leadsto \color{blue}{\left(\frac{\sin x}{x \cdot \cos x} + \left(\frac{{\left(\sin x\right)}^{2}}{{x}^{2} \cdot {\left(\cos x\right)}^{2}} + 1\right)\right) - \left(\frac{\sin x}{x} + \frac{{\left(\sin x\right)}^{2}}{{x}^{2} \cdot \cos x}\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.1

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

Reproduce

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