Average Error: 29.6 → 15.3
Time: 3.9s
Precision: binary64
\[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ \mathbf{if}\;t_0 - \sqrt[3]{x} \leq 7.126099148990761 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(0.06172839506172839, \sqrt[3]{\frac{1}{{x}^{8}}}, \mathsf{fma}\left(\sqrt[3]{\frac{1}{{x}^{5}}}, -0.1111111111111111, 0.3333333333333333 \cdot \sqrt[3]{\frac{1}{x \cdot x}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(t_0\right)\right) - \sqrt[3]{x}\\ \end{array} \]
\sqrt[3]{x + 1} - \sqrt[3]{x}
\begin{array}{l}
t_0 := \sqrt[3]{x + 1}\\
\mathbf{if}\;t_0 - \sqrt[3]{x} \leq 7.126099148990761 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(0.06172839506172839, \sqrt[3]{\frac{1}{{x}^{8}}}, \mathsf{fma}\left(\sqrt[3]{\frac{1}{{x}^{5}}}, -0.1111111111111111, 0.3333333333333333 \cdot \sqrt[3]{\frac{1}{x \cdot x}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(t_0\right)\right) - \sqrt[3]{x}\\


\end{array}
(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (cbrt x)))
(FPCore (x)
 :precision binary64
 (let* ((t_0 (cbrt (+ x 1.0))))
   (if (<= (- t_0 (cbrt x)) 7.126099148990761e-5)
     (fma
      0.06172839506172839
      (cbrt (/ 1.0 (pow x 8.0)))
      (fma
       (cbrt (/ 1.0 (pow x 5.0)))
       -0.1111111111111111
       (* 0.3333333333333333 (cbrt (/ 1.0 (* x x))))))
     (- (log1p (expm1 t_0)) (cbrt x)))))
double code(double x) {
	return cbrt((x + 1.0)) - cbrt(x);
}
double code(double x) {
	double t_0 = cbrt((x + 1.0));
	double tmp;
	if ((t_0 - cbrt(x)) <= 7.126099148990761e-5) {
		tmp = fma(0.06172839506172839, cbrt((1.0 / pow(x, 8.0))), fma(cbrt((1.0 / pow(x, 5.0))), -0.1111111111111111, (0.3333333333333333 * cbrt((1.0 / (x * x))))));
	} else {
		tmp = log1p(expm1(t_0)) - cbrt(x);
	}
	return tmp;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 7.126099149e-5

    1. Initial program 60.4

      \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
    2. Taylor expanded in x around inf 39.0

      \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot {\left(\frac{1}{{x}^{2}}\right)}^{0.3333333333333333} + 0.06172839506172839 \cdot {\left(\frac{1}{{x}^{8}}\right)}^{0.3333333333333333}\right) - 0.1111111111111111 \cdot {\left(\frac{1}{{x}^{5}}\right)}^{0.3333333333333333}} \]
    3. Simplified31.0

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.06172839506172839, \sqrt[3]{\frac{1}{{x}^{8}}}, \mathsf{fma}\left(\sqrt[3]{\frac{1}{{x}^{5}}}, -0.1111111111111111, 0.3333333333333333 \cdot \sqrt[3]{\frac{1}{x \cdot x}}\right)\right)} \]

    if 7.126099149e-5 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x))

    1. Initial program 0.2

      \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
    2. Applied egg-rr0.3

      \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sqrt[3]{x + 1}\right)\right)} - \sqrt[3]{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification15.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sqrt[3]{x + 1} - \sqrt[3]{x} \leq 7.126099148990761 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(0.06172839506172839, \sqrt[3]{\frac{1}{{x}^{8}}}, \mathsf{fma}\left(\sqrt[3]{\frac{1}{{x}^{5}}}, -0.1111111111111111, 0.3333333333333333 \cdot \sqrt[3]{\frac{1}{x \cdot x}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\sqrt[3]{x + 1}\right)\right) - \sqrt[3]{x}\\ \end{array} \]

Reproduce

herbie shell --seed 2022130 
(FPCore (x)
  :name "2cbrt (problem 3.3.4)"
  :precision binary64
  (- (cbrt (+ x 1.0)) (cbrt x)))