Average Error: 31.5 → 0.0
Time: 14.0s
Precision: binary64
\[\frac{x - \sin x}{x - \tan x} \]
\[\begin{array}{l} t_0 := x - \tan x\\ t_1 := \frac{x}{t_0} - \frac{\sin x}{t_0}\\ \mathbf{if}\;x \leq -0.10457701635274878:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 0.09287712393157785:\\ \;\;\;\;\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}:\\ \;\;\;\;t_1\\ \end{array} \]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
t_0 := x - \tan x\\
t_1 := \frac{x}{t_0} - \frac{\sin x}{t_0}\\
\mathbf{if}\;x \leq -0.10457701635274878:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 0.09287712393157785:\\
\;\;\;\;\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}:\\
\;\;\;\;t_1\\


\end{array}
(FPCore (x) :precision binary64 (/ (- x (sin x)) (- x (tan x))))
(FPCore (x)
 :precision binary64
 (let* ((t_0 (- x (tan x))) (t_1 (- (/ x t_0) (/ (sin x) t_0))))
   (if (<= x -0.10457701635274878)
     t_1
     (if (<= x 0.09287712393157785)
       (fma
        0.225
        (* x x)
        (fma
         0.00024107142857142857
         (pow x 6.0)
         (fma (pow x 4.0) -0.009642857142857142 -0.5)))
       t_1))))
double code(double x) {
	return (x - sin(x)) / (x - tan(x));
}
double code(double x) {
	double t_0 = x - tan(x);
	double t_1 = (x / t_0) - (sin(x) / t_0);
	double tmp;
	if (x <= -0.10457701635274878) {
		tmp = t_1;
	} else if (x <= 0.09287712393157785) {
		tmp = fma(0.225, (x * x), fma(0.00024107142857142857, pow(x, 6.0), fma(pow(x, 4.0), -0.009642857142857142, -0.5)));
	} else {
		tmp = t_1;
	}
	return tmp;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.104577016352748783 or 0.092877123931577849 < x

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x} \]
    2. Applied div-sub_binary640.0

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

    if -0.104577016352748783 < x < 0.092877123931577849

    1. Initial program 63.1

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

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

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

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

      \[\leadsto \color{blue}{\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)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.10457701635274878:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \leq 0.09287712393157785:\\ \;\;\;\;\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}:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \end{array} \]

Reproduce

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