Average Error: 30.0 → 0.5
Time: 3.5s
Precision: binary64
\[\sqrt[3]{x + 1} - \sqrt[3]{x}\]
\[\begin{array}{l} \mathbf{if}\;\sqrt[3]{x + 1} - \sqrt[3]{x} \leq 3.1780440394868492 \cdot 10^{-06}:\\ \;\;\;\;\frac{\sqrt[3]{x}}{x} \cdot \left(0.3333333333333333 + \log \left(e^{\frac{-0.1111111111111111}{x}}\right)\right) + \left(\sqrt[3]{x} - \sqrt[3]{x}\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\sqrt[3]{x + 1} - \sqrt[3]{x}\right)}\\ \end{array}\]
\sqrt[3]{x + 1} - \sqrt[3]{x}
\begin{array}{l}
\mathbf{if}\;\sqrt[3]{x + 1} - \sqrt[3]{x} \leq 3.1780440394868492 \cdot 10^{-06}:\\
\;\;\;\;\frac{\sqrt[3]{x}}{x} \cdot \left(0.3333333333333333 + \log \left(e^{\frac{-0.1111111111111111}{x}}\right)\right) + \left(\sqrt[3]{x} - \sqrt[3]{x}\right)\\

\mathbf{else}:\\
\;\;\;\;e^{\log \left(\sqrt[3]{x + 1} - \sqrt[3]{x}\right)}\\

\end{array}
(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (cbrt x)))
(FPCore (x)
 :precision binary64
 (if (<= (- (cbrt (+ x 1.0)) (cbrt x)) 3.1780440394868492e-06)
   (+
    (*
     (/ (cbrt x) x)
     (+ 0.3333333333333333 (log (exp (/ -0.1111111111111111 x)))))
    (- (cbrt x) (cbrt x)))
   (exp (log (- (cbrt (+ x 1.0)) (cbrt x))))))
double code(double x) {
	return cbrt(x + 1.0) - cbrt(x);
}
double code(double x) {
	double tmp;
	if ((cbrt(x + 1.0) - cbrt(x)) <= 3.1780440394868492e-06) {
		tmp = ((cbrt(x) / x) * (0.3333333333333333 + log(exp(-0.1111111111111111 / x)))) + (cbrt(x) - cbrt(x));
	} else {
		tmp = exp(log(cbrt(x + 1.0) - 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)) < 3.178044039e-6

    1. Initial program 60.6

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

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{x}}{x} \cdot \left(0.3333333333333333 + \frac{-0.1111111111111111}{x}\right) + \left(\sqrt[3]{x} - \sqrt[3]{x}\right)}\]
    4. Using strategy rm
    5. Applied add-log-exp_binary64_4500.6

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

    if 3.178044039e-6 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x))

    1. Initial program 0.3

      \[\sqrt[3]{x + 1} - \sqrt[3]{x}\]
    2. Using strategy rm
    3. Applied add-exp-log_binary64_4490.3

      \[\leadsto \color{blue}{e^{\log \left(\sqrt[3]{x + 1} - \sqrt[3]{x}\right)}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.5

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

Reproduce

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