Average Error: 31.4 → 0.0
Time: 18.8s
Precision: binary64
\[\frac{x - \sin x}{x - \tan x} \]
\[\begin{array}{l} t_0 := x - \tan x\\ t_1 := \frac{x}{t_0}\\ \mathbf{if}\;x \leq -0.09789578775807517:\\ \;\;\;\;\begin{array}{l} t_2 := \sqrt[3]{t_1 - \frac{\sin x}{t_0}}\\ t_3 := \mathsf{fma}\left(-\frac{\sin x}{\sqrt[3]{t_0}}, \frac{1}{\sqrt[3]{t_0} \cdot \sqrt[3]{t_0}}, \frac{\sin x}{\sqrt[3]{t_0}} \cdot \frac{1}{\sqrt[3]{t_0} \cdot \sqrt[3]{t_0}}\right)\\ t_4 := \frac{\sin x}{\sqrt[3]{t_0}}\\ t_5 := \sqrt[3]{t_0}\\ t_6 := \frac{1}{t_5 \cdot t_5}\\ t_7 := t_5 \cdot t_5\\ t_3 + t_2 \cdot \left(t_2 \cdot \sqrt[3]{\mathsf{fma}\left(1, t_1, t_4 \cdot \frac{-1}{t_7}\right) + t_3}\right) \end{array}\\ \mathbf{elif}\;x \leq 0.09493097848297538:\\ \;\;\;\;\mathsf{fma}\left(0.225, x \cdot x, 0.00024107142857142857 \cdot {x}^{6}\right) - \mathsf{fma}\left(0.009642857142857142, {x}^{4}, 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_8 := \frac{-1}{t_0}\\ \mathsf{fma}\left(1, t_1, \sin x \cdot t_8\right) + \mathsf{fma}\left(t_8, \sin x, \sin x \cdot \frac{1}{t_0}\right) \end{array}\\ \end{array} \]
\frac{x - \sin x}{x - \tan x}
\begin{array}{l}
t_0 := x - \tan x\\
t_1 := \frac{x}{t_0}\\
\mathbf{if}\;x \leq -0.09789578775807517:\\
\;\;\;\;\begin{array}{l}
t_2 := \sqrt[3]{t_1 - \frac{\sin x}{t_0}}\\
t_3 := \mathsf{fma}\left(-\frac{\sin x}{\sqrt[3]{t_0}}, \frac{1}{\sqrt[3]{t_0} \cdot \sqrt[3]{t_0}}, \frac{\sin x}{\sqrt[3]{t_0}} \cdot \frac{1}{\sqrt[3]{t_0} \cdot \sqrt[3]{t_0}}\right)\\
t_4 := \frac{\sin x}{\sqrt[3]{t_0}}\\
t_5 := \sqrt[3]{t_0}\\
t_6 := \frac{1}{t_5 \cdot t_5}\\
t_7 := t_5 \cdot t_5\\
t_3 + t_2 \cdot \left(t_2 \cdot \sqrt[3]{\mathsf{fma}\left(1, t_1, t_4 \cdot \frac{-1}{t_7}\right) + t_3}\right)
\end{array}\\

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

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_8 := \frac{-1}{t_0}\\
\mathsf{fma}\left(1, t_1, \sin x \cdot t_8\right) + \mathsf{fma}\left(t_8, \sin x, \sin x \cdot \frac{1}{t_0}\right)
\end{array}\\


\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)))
   (if (<= x -0.09789578775807517)
     (let* ((t_2 (cbrt (- t_1 (/ (sin x) t_0))))
            (t_3
             (fma
              (- (/ (sin x) (cbrt t_0)))
              (/ 1.0 (* (cbrt t_0) (cbrt t_0)))
              (* (/ (sin x) (cbrt t_0)) (/ 1.0 (* (cbrt t_0) (cbrt t_0))))))
            (t_4 (/ (sin x) (cbrt t_0)))
            (t_5 (cbrt t_0))
            (t_6 (/ 1.0 (* t_5 t_5)))
            (t_7 (* t_5 t_5)))
       (+
        t_3
        (* t_2 (* t_2 (cbrt (+ (fma 1.0 t_1 (* t_4 (/ -1.0 t_7))) t_3))))))
     (if (<= x 0.09493097848297538)
       (-
        (fma 0.225 (* x x) (* 0.00024107142857142857 (pow x 6.0)))
        (fma 0.009642857142857142 (pow x 4.0) 0.5))
       (let* ((t_8 (/ -1.0 t_0)))
         (+
          (fma 1.0 t_1 (* (sin x) t_8))
          (fma t_8 (sin x) (* (sin x) (/ 1.0 t_0)))))))))
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;
	double tmp;
	if (x <= -0.09789578775807517) {
		double t_2_1 = cbrt(t_1 - (sin(x) / t_0));
		double t_3_2 = fma(-(sin(x) / cbrt(t_0)), (1.0 / (cbrt(t_0) * cbrt(t_0))), ((sin(x) / cbrt(t_0)) * (1.0 / (cbrt(t_0) * cbrt(t_0)))));
		double t_4_3 = sin(x) / cbrt(t_0);
		double t_5_4 = cbrt(t_0);
		double t_6_5 = 1.0 / (t_5_4 * t_5_4);
		double t_7_6 = t_5_4 * t_5_4;
		tmp = t_3_2 + (t_2_1 * (t_2_1 * cbrt(fma(1.0, t_1, (t_4_3 * (-1.0 / t_7_6))) + t_3_2)));
	} else if (x <= 0.09493097848297538) {
		tmp = fma(0.225, (x * x), (0.00024107142857142857 * pow(x, 6.0))) - fma(0.009642857142857142, pow(x, 4.0), 0.5);
	} else {
		double t_8 = -1.0 / t_0;
		tmp = fma(1.0, t_1, (sin(x) * t_8)) + fma(t_8, sin(x), (sin(x) * (1.0 / t_0)));
	}
	return tmp;
}

Error

Bits error versus x

Derivation

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

    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}} \]
    3. Applied add-cube-cbrt_binary640.0

      \[\leadsto \frac{x}{x - \tan x} - \frac{\sin x}{\color{blue}{\left(\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}\right) \cdot \sqrt[3]{x - \tan x}}} \]
    4. Applied *-un-lft-identity_binary640.0

      \[\leadsto \frac{x}{x - \tan x} - \frac{\color{blue}{1 \cdot \sin x}}{\left(\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}\right) \cdot \sqrt[3]{x - \tan x}} \]
    5. Applied times-frac_binary640.0

      \[\leadsto \frac{x}{x - \tan x} - \color{blue}{\frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}} \cdot \frac{\sin x}{\sqrt[3]{x - \tan x}}} \]
    6. Applied *-un-lft-identity_binary640.0

      \[\leadsto \color{blue}{1 \cdot \frac{x}{x - \tan x}} - \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}} \cdot \frac{\sin x}{\sqrt[3]{x - \tan x}} \]
    7. Applied prod-diff_binary640.0

      \[\leadsto \color{blue}{\mathsf{fma}\left(1, \frac{x}{x - \tan x}, -\frac{\sin x}{\sqrt[3]{x - \tan x}} \cdot \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}\right) + \mathsf{fma}\left(-\frac{\sin x}{\sqrt[3]{x - \tan x}}, \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}, \frac{\sin x}{\sqrt[3]{x - \tan x}} \cdot \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}\right)} \]
    8. Applied add-cube-cbrt_binary640.1

      \[\leadsto \color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(1, \frac{x}{x - \tan x}, -\frac{\sin x}{\sqrt[3]{x - \tan x}} \cdot \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}\right)} \cdot \sqrt[3]{\mathsf{fma}\left(1, \frac{x}{x - \tan x}, -\frac{\sin x}{\sqrt[3]{x - \tan x}} \cdot \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(1, \frac{x}{x - \tan x}, -\frac{\sin x}{\sqrt[3]{x - \tan x}} \cdot \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}\right)}} + \mathsf{fma}\left(-\frac{\sin x}{\sqrt[3]{x - \tan x}}, \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}, \frac{\sin x}{\sqrt[3]{x - \tan x}} \cdot \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}\right) \]
    9. Simplified0.1

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}} \cdot \sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\right)} \cdot \sqrt[3]{\mathsf{fma}\left(1, \frac{x}{x - \tan x}, -\frac{\sin x}{\sqrt[3]{x - \tan x}} \cdot \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}\right)} + \mathsf{fma}\left(-\frac{\sin x}{\sqrt[3]{x - \tan x}}, \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}, \frac{\sin x}{\sqrt[3]{x - \tan x}} \cdot \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}\right) \]
    10. Simplified0.1

      \[\leadsto \left(\sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}} \cdot \sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\right) \cdot \color{blue}{\sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}} + \mathsf{fma}\left(-\frac{\sin x}{\sqrt[3]{x - \tan x}}, \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}, \frac{\sin x}{\sqrt[3]{x - \tan x}} \cdot \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}\right) \]
    11. Applied add-cube-cbrt_binary640.1

      \[\leadsto \left(\sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}} \cdot \sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{\color{blue}{\left(\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}\right) \cdot \sqrt[3]{x - \tan x}}}}\right) \cdot \sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}} + \mathsf{fma}\left(-\frac{\sin x}{\sqrt[3]{x - \tan x}}, \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}, \frac{\sin x}{\sqrt[3]{x - \tan x}} \cdot \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}\right) \]
    12. Applied *-un-lft-identity_binary640.1

      \[\leadsto \left(\sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}} \cdot \sqrt[3]{\frac{x}{x - \tan x} - \frac{\color{blue}{1 \cdot \sin x}}{\left(\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}\right) \cdot \sqrt[3]{x - \tan x}}}\right) \cdot \sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}} + \mathsf{fma}\left(-\frac{\sin x}{\sqrt[3]{x - \tan x}}, \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}, \frac{\sin x}{\sqrt[3]{x - \tan x}} \cdot \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}\right) \]
    13. Applied times-frac_binary640.1

      \[\leadsto \left(\sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}} \cdot \sqrt[3]{\frac{x}{x - \tan x} - \color{blue}{\frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}} \cdot \frac{\sin x}{\sqrt[3]{x - \tan x}}}}\right) \cdot \sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}} + \mathsf{fma}\left(-\frac{\sin x}{\sqrt[3]{x - \tan x}}, \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}, \frac{\sin x}{\sqrt[3]{x - \tan x}} \cdot \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}\right) \]
    14. Applied *-un-lft-identity_binary640.1

      \[\leadsto \left(\sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}} \cdot \sqrt[3]{\color{blue}{1 \cdot \frac{x}{x - \tan x}} - \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}} \cdot \frac{\sin x}{\sqrt[3]{x - \tan x}}}\right) \cdot \sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}} + \mathsf{fma}\left(-\frac{\sin x}{\sqrt[3]{x - \tan x}}, \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}, \frac{\sin x}{\sqrt[3]{x - \tan x}} \cdot \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}\right) \]
    15. Applied prod-diff_binary640.1

      \[\leadsto \left(\sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}} \cdot \sqrt[3]{\color{blue}{\mathsf{fma}\left(1, \frac{x}{x - \tan x}, -\frac{\sin x}{\sqrt[3]{x - \tan x}} \cdot \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}\right) + \mathsf{fma}\left(-\frac{\sin x}{\sqrt[3]{x - \tan x}}, \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}, \frac{\sin x}{\sqrt[3]{x - \tan x}} \cdot \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}\right)}}\right) \cdot \sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}} + \mathsf{fma}\left(-\frac{\sin x}{\sqrt[3]{x - \tan x}}, \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}, \frac{\sin x}{\sqrt[3]{x - \tan x}} \cdot \frac{1}{\sqrt[3]{x - \tan x} \cdot \sqrt[3]{x - \tan x}}\right) \]

    if -0.09789578775807517 < x < 0.094930978482975381

    1. Initial program 63.0

      \[\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)} \]

    if 0.094930978482975381 < 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}} \]
    3. Applied div-inv_binary640.0

      \[\leadsto \frac{x}{x - \tan x} - \color{blue}{\sin x \cdot \frac{1}{x - \tan x}} \]
    4. Applied *-un-lft-identity_binary640.0

      \[\leadsto \frac{x}{\color{blue}{1 \cdot \left(x - \tan x\right)}} - \sin x \cdot \frac{1}{x - \tan x} \]
    5. Applied *-un-lft-identity_binary640.0

      \[\leadsto \frac{\color{blue}{1 \cdot x}}{1 \cdot \left(x - \tan x\right)} - \sin x \cdot \frac{1}{x - \tan x} \]
    6. Applied times-frac_binary640.0

      \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{x}{x - \tan x}} - \sin x \cdot \frac{1}{x - \tan x} \]
    7. Applied prod-diff_binary640.0

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{1}, \frac{x}{x - \tan x}, -\frac{1}{x - \tan x} \cdot \sin x\right) + \mathsf{fma}\left(-\frac{1}{x - \tan x}, \sin x, \frac{1}{x - \tan x} \cdot \sin x\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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