Average Error: 31.5 → 0.2
Time: 9.6s
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(\sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}\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(\sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}\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) cbrt(((double) fma(0.225, ((double) pow(x, 2.0)), ((double) -(((double) cbrt(((double) pow(((double) fma(0.009642857142857142, ((double) pow(x, 4.0)), 0.5)), 3.0)))))))))) * ((double) cbrt(((double) fma(0.225, ((double) pow(x, 2.0)), ((double) -(((double) fma(0.009642857142857142, ((double) pow(x, 4.0)), 0.5)))))))))) * ((double) cbrt(((double) fma(0.225, ((double) pow(x, 2.0)), ((double) -(((double) cbrt(((double) pow(((double) fma(0.009642857142857142, ((double) pow(x, 4.0)), 0.5)), 3.0))))))))))));
		} 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. Simplified0.1

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}\]
    4. Using strategy rm
    5. Applied add-cbrt-cube1.1

      \[\leadsto \mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\color{blue}{\sqrt[3]{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right) \cdot \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right) \cdot \mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)}}\right)\]
    6. Simplified1.1

      \[\leadsto \mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{\color{blue}{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}}\right)\]
    7. Using strategy rm
    8. Applied add-cube-cbrt1.7

      \[\leadsto \color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}\right)}}\]
    9. Using strategy rm
    10. Applied add-cbrt-cube1.1

      \[\leadsto \left(\sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}\right)} \cdot \color{blue}{\sqrt[3]{\left(\sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}\right)}}}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}\right)}\]
    11. Simplified0.1

      \[\leadsto \left(\sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}\right)} \cdot \sqrt[3]{\color{blue}{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}\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.2

    \[\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(\sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\frac{9}{40}, {x}^{2}, -\sqrt[3]{{\left(\mathsf{fma}\left(\frac{27}{2800}, {x}^{4}, \frac{1}{2}\right)\right)}^{3}}\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 +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  :precision binary64
  (/ (- x (sin x)) (- x (tan x))))