Average Error: 29.8 → 0.6
Time: 4.4s
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 6.406858612706401 \cdot 10^{-5}:\\ \;\;\;\;\frac{\sqrt[3]{x}}{x} \cdot \left(0.3333333333333333 - \frac{0.1111111111111111}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_1 := \sqrt{t_0}\\ t_1 \cdot t_1 - \sqrt[3]{x} \end{array}\\ \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 6.406858612706401 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sqrt[3]{x}}{x} \cdot \left(0.3333333333333333 - \frac{0.1111111111111111}{x}\right)\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \sqrt{t_0}\\
t_1 \cdot t_1 - \sqrt[3]{x}
\end{array}\\


\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)) 6.406858612706401e-5)
     (* (/ (cbrt x) x) (- 0.3333333333333333 (/ 0.1111111111111111 x)))
     (let* ((t_1 (sqrt t_0))) (- (* t_1 t_1) (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)) <= 6.406858612706401e-5) {
		tmp = (cbrt(x) / x) * (0.3333333333333333 - (0.1111111111111111 / x));
	} else {
		double t_1 = sqrt(t_0);
		tmp = (t_1 * t_1) - cbrt(x);
	}
	return tmp;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

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

    1. Initial program 60.4

      \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
    2. Applied add-cbrt-cube_binary6460.5

      \[\leadsto \sqrt[3]{x + 1} - \color{blue}{\sqrt[3]{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}} \]
    3. Applied add-cube-cbrt_binary6460.5

      \[\leadsto \sqrt[3]{x + 1} - \sqrt[3]{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}} \]
    4. Applied cbrt-prod_binary6460.6

      \[\leadsto \sqrt[3]{x + 1} - \sqrt[3]{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \color{blue}{\left(\sqrt[3]{\sqrt[3]{x} \cdot \sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}\right)}} \]
    5. Taylor expanded in x around -inf 64.0

      \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot \frac{e^{0.3333333333333333 \cdot \left(\log -1 - \log \left(\frac{-1}{x}\right)\right)}}{x} + e^{0.3333333333333333 \cdot \left(\log -1 - \log \left(\frac{-1}{x}\right)\right)}\right) - \left(0.1111111111111111 \cdot \frac{e^{0.3333333333333333 \cdot \left(\log -1 - \log \left(\frac{-1}{x}\right)\right)}}{{x}^{2}} + {\left(-1 \cdot x\right)}^{0.3333333333333333} \cdot \sqrt[3]{-1}\right)} \]
    6. Simplified0.6

      \[\leadsto \color{blue}{\frac{\sqrt[3]{x}}{x} \cdot \left(0.3333333333333333 - \frac{0.1111111111111111}{x}\right)} \]

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

    1. Initial program 0.2

      \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
    2. Applied add-sqr-sqrt_binary640.6

      \[\leadsto \color{blue}{\sqrt{\sqrt[3]{x + 1}} \cdot \sqrt{\sqrt[3]{x + 1}}} - \sqrt[3]{x} \]
    3. Simplified0.6

      \[\leadsto \color{blue}{\sqrt{\sqrt[3]{1 + x}}} \cdot \sqrt{\sqrt[3]{x + 1}} - \sqrt[3]{x} \]
    4. Simplified0.6

      \[\leadsto \sqrt{\sqrt[3]{1 + x}} \cdot \color{blue}{\sqrt{\sqrt[3]{1 + x}}} - \sqrt[3]{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sqrt[3]{x + 1} - \sqrt[3]{x} \leq 6.406858612706401 \cdot 10^{-5}:\\ \;\;\;\;\frac{\sqrt[3]{x}}{x} \cdot \left(0.3333333333333333 - \frac{0.1111111111111111}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\sqrt[3]{x + 1}} \cdot \sqrt{\sqrt[3]{x + 1}} - \sqrt[3]{x}\\ \end{array} \]

Reproduce

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