\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \leq -4.889551851038275:\\
\;\;\;\;1 + \frac{\frac{\sin x}{\cos x} - \sin x}{x}\\
\mathbf{elif}\;x \leq 2.6377554044873825:\\
\;\;\;\;\mathsf{fma}\left(0.225, x \cdot x, \mathsf{fma}\left(0.00024107142857142857, {x}^{6}, \mathsf{fma}\left({x}^{4}, -0.009642857142857142, -0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_0 := {\sin x}^{3}\\
t_1 := {\sin x}^{2}\\
t_2 := {\cos x}^{2}\\
\left(\frac{\sin x}{x \cdot \cos x} + \left(1 + \left(\frac{t_0}{{\cos x}^{3} \cdot {x}^{3}} + \frac{t_1}{t_2 \cdot {x}^{2}}\right)\right)\right) - \left(\frac{t_0}{{x}^{3} \cdot t_2} + \left(\frac{t_1}{\cos x \cdot {x}^{2}} + \frac{\sin x}{x}\right)\right)
\end{array}\\
\end{array}
(FPCore (x) :precision binary64 (/ (- x (sin x)) (- x (tan x))))
(FPCore (x)
:precision binary64
(if (<= x -4.889551851038275)
(+ 1.0 (/ (- (/ (sin x) (cos x)) (sin x)) x))
(if (<= x 2.6377554044873825)
(fma
0.225
(* x x)
(fma
0.00024107142857142857
(pow x 6.0)
(fma (pow x 4.0) -0.009642857142857142 -0.5)))
(let* ((t_0 (pow (sin x) 3.0))
(t_1 (pow (sin x) 2.0))
(t_2 (pow (cos x) 2.0)))
(-
(+
(/ (sin x) (* x (cos x)))
(+
1.0
(+
(/ t_0 (* (pow (cos x) 3.0) (pow x 3.0)))
(/ t_1 (* t_2 (pow x 2.0))))))
(+
(/ t_0 (* (pow x 3.0) t_2))
(+ (/ t_1 (* (cos x) (pow x 2.0))) (/ (sin x) x))))))))double code(double x) {
return (x - sin(x)) / (x - tan(x));
}
double code(double x) {
double tmp;
if (x <= -4.889551851038275) {
tmp = 1.0 + (((sin(x) / cos(x)) - sin(x)) / x);
} else if (x <= 2.6377554044873825) {
tmp = fma(0.225, (x * x), fma(0.00024107142857142857, pow(x, 6.0), fma(pow(x, 4.0), -0.009642857142857142, -0.5)));
} else {
double t_0 = pow(sin(x), 3.0);
double t_1 = pow(sin(x), 2.0);
double t_2 = pow(cos(x), 2.0);
tmp = ((sin(x) / (x * cos(x))) + (1.0 + ((t_0 / (pow(cos(x), 3.0) * pow(x, 3.0))) + (t_1 / (t_2 * pow(x, 2.0)))))) - ((t_0 / (pow(x, 3.0) * t_2)) + ((t_1 / (cos(x) * pow(x, 2.0))) + (sin(x) / x)));
}
return tmp;
}



Bits error versus x
if x < -4.8895518510382754Initial program 0.0
Taylor expanded around inf 0.5
Simplified0.5
Taylor expanded around inf 0.5
if -4.8895518510382754 < x < 2.6377554044873825Initial program 62.9
Taylor expanded around 0 0.1
Simplified0.1
Taylor expanded around 0 0.1
Simplified0.1
if 2.6377554044873825 < x Initial program 0.0
Taylor expanded around inf 0.3
Final simplification0.3
herbie shell --seed 2021210
(FPCore (x)
:name "sintan (problem 3.4.5)"
:precision binary64
(/ (- x (sin x)) (- x (tan x))))