Average Error: 31.3 → 0.2
Time: 11.2s
Precision: binary64
\[\frac{x - \sin x}{x - \tan x} \]
\[\begin{array}{l} \mathbf{if}\;x \leq -2.420166958477668:\\ \;\;\;\;\begin{array}{l} t_0 := x \cdot \cos x\\ t_1 := \frac{\sin x}{x}\\ \left(\frac{\sin x}{t_0} + \left(1 + \frac{{t_1}^{2}}{{\cos x}^{2}}\right)\right) - \left(t_1 + \frac{{\sin x}^{2}}{x \cdot t_0}\right) \end{array}\\ \mathbf{elif}\;x \leq 0.02665164670869842:\\ \;\;\;\;\mathsf{fma}\left({x}^{4}, -0.009642857142857142, \mathsf{fma}\left(0.225, x \cdot x, -0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{{\left(\frac{x - \sin x}{x - \tan x}\right)}^{3}}\\ \end{array} \]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
\mathbf{if}\;x \leq -2.420166958477668:\\
\;\;\;\;\begin{array}{l}
t_0 := x \cdot \cos x\\
t_1 := \frac{\sin x}{x}\\
\left(\frac{\sin x}{t_0} + \left(1 + \frac{{t_1}^{2}}{{\cos x}^{2}}\right)\right) - \left(t_1 + \frac{{\sin x}^{2}}{x \cdot t_0}\right)
\end{array}\\

\mathbf{elif}\;x \leq 0.02665164670869842:\\
\;\;\;\;\mathsf{fma}\left({x}^{4}, -0.009642857142857142, \mathsf{fma}\left(0.225, x \cdot x, -0.5\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(\frac{x - \sin x}{x - \tan x}\right)}^{3}}\\


\end{array}
(FPCore (x) :precision binary64 (/ (- x (sin x)) (- x (tan x))))
(FPCore (x)
 :precision binary64
 (if (<= x -2.420166958477668)
   (let* ((t_0 (* x (cos x))) (t_1 (/ (sin x) x)))
     (-
      (+ (/ (sin x) t_0) (+ 1.0 (/ (pow t_1 2.0) (pow (cos x) 2.0))))
      (+ t_1 (/ (pow (sin x) 2.0) (* x t_0)))))
   (if (<= x 0.02665164670869842)
     (fma (pow x 4.0) -0.009642857142857142 (fma 0.225 (* x x) -0.5))
     (cbrt (pow (/ (- x (sin x)) (- x (tan x))) 3.0)))))
double code(double x) {
	return (x - sin(x)) / (x - tan(x));
}
double code(double x) {
	double tmp;
	if (x <= -2.420166958477668) {
		double t_0_1 = x * cos(x);
		double t_1_2 = sin(x) / x;
		tmp = ((sin(x) / t_0_1) + (1.0 + (pow(t_1_2, 2.0) / pow(cos(x), 2.0)))) - (t_1_2 + (pow(sin(x), 2.0) / (x * t_0_1)));
	} else if (x <= 0.02665164670869842) {
		tmp = fma(pow(x, 4.0), -0.009642857142857142, fma(0.225, (x * x), -0.5));
	} else {
		tmp = cbrt(pow(((x - sin(x)) / (x - tan(x))), 3.0));
	}
	return tmp;
}

Error

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if x < -2.4201669584776679

    1. Initial program 0.0

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

      \[\leadsto \color{blue}{\left(\frac{\sin x}{\cos x \cdot x} + \left(1 + \frac{{\sin x}^{2}}{{\cos x}^{2} \cdot {x}^{2}}\right)\right) - \left(\frac{{\sin x}^{2}}{\cos x \cdot {x}^{2}} + \frac{\sin x}{x}\right)} \]
    3. Simplified0.5

      \[\leadsto \color{blue}{\left(\frac{\sin x}{x \cdot \cos x} + \left(1 + \frac{{\sin x}^{2}}{\left(x \cdot x\right) \cdot {\cos x}^{2}}\right)\right) - \left(\frac{\sin x}{x} + \frac{{\sin x}^{2}}{x \cdot \left(x \cdot \cos x\right)}\right)} \]
    4. Using strategy rm
    5. Applied associate-/r*_binary640.5

      \[\leadsto \left(\frac{\sin x}{x \cdot \cos x} + \left(1 + \color{blue}{\frac{\frac{{\sin x}^{2}}{x \cdot x}}{{\cos x}^{2}}}\right)\right) - \left(\frac{\sin x}{x} + \frac{{\sin x}^{2}}{x \cdot \left(x \cdot \cos x\right)}\right) \]
    6. Simplified0.5

      \[\leadsto \left(\frac{\sin x}{x \cdot \cos x} + \left(1 + \frac{\color{blue}{{\left(\frac{\sin x}{x}\right)}^{2}}}{{\cos x}^{2}}\right)\right) - \left(\frac{\sin x}{x} + \frac{{\sin x}^{2}}{x \cdot \left(x \cdot \cos x\right)}\right) \]

    if -2.4201669584776679 < x < 0.02665164670869842

    1. Initial program 62.9

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

      \[\leadsto \color{blue}{0.225 \cdot {x}^{2} - \left(0.009642857142857142 \cdot {x}^{4} + 0.5\right)} \]
    3. Simplified0.2

      \[\leadsto \color{blue}{0.225 \cdot \left(x \cdot x\right) - \mathsf{fma}\left(0.009642857142857142, {x}^{4}, 0.5\right)} \]
    4. Using strategy rm
    5. Applied fma-udef_binary640.2

      \[\leadsto 0.225 \cdot \left(x \cdot x\right) - \color{blue}{\left(0.009642857142857142 \cdot {x}^{4} + 0.5\right)} \]
    6. Applied associate--r+_binary640.2

      \[\leadsto \color{blue}{\left(0.225 \cdot \left(x \cdot x\right) - 0.009642857142857142 \cdot {x}^{4}\right) - 0.5} \]
    7. Simplified0.2

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.225, x \cdot x, {x}^{4} \cdot -0.009642857142857142\right)} - 0.5 \]
    8. Taylor expanded around 0 0.2

      \[\leadsto \color{blue}{0.225 \cdot {x}^{2} - \left(0.009642857142857142 \cdot {x}^{4} + 0.5\right)} \]
    9. Simplified0.2

      \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{4}, -0.009642857142857142, \mathsf{fma}\left(0.225, x \cdot x, -0.5\right)\right)} \]

    if 0.02665164670869842 < x

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x} \]
    2. Using strategy rm
    3. Applied add-cbrt-cube_binary640.1

      \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{x - \sin x}{x - \tan x} \cdot \frac{x - \sin x}{x - \tan x}\right) \cdot \frac{x - \sin x}{x - \tan x}}} \]
    4. Simplified0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.420166958477668:\\ \;\;\;\;\left(\frac{\sin x}{x \cdot \cos x} + \left(1 + \frac{{\left(\frac{\sin x}{x}\right)}^{2}}{{\cos x}^{2}}\right)\right) - \left(\frac{\sin x}{x} + \frac{{\sin x}^{2}}{x \cdot \left(x \cdot \cos x\right)}\right)\\ \mathbf{elif}\;x \leq 0.02665164670869842:\\ \;\;\;\;\mathsf{fma}\left({x}^{4}, -0.009642857142857142, \mathsf{fma}\left(0.225, x \cdot x, -0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{{\left(\frac{x - \sin x}{x - \tan x}\right)}^{3}}\\ \end{array} \]

Reproduce

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