Average Error: 29.9 → 0.5
Time: 15.4s
Precision: binary64
Cost: 45764
\[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ \mathbf{if}\;\sqrt[3]{x} \ne 0:\\ \;\;\;\;\frac{--1}{\mathsf{fma}\left(\sqrt[3]{x}, t_0 + \sqrt[3]{x}, {t_0}^{2}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0 - \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 (!= (cbrt x) 0.0)
     (/ (- -1.0) (fma (cbrt x) (+ t_0 (cbrt x)) (pow t_0 2.0)))
     (- 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 (cbrt(x) != 0.0) {
		tmp = -(-1.0) / fma(cbrt(x), (t_0 + cbrt(x)), pow(t_0, 2.0));
	} else {
		tmp = t_0 - cbrt(x);
	}
	return tmp;
}
function code(x)
	return Float64(cbrt(Float64(x + 1.0)) - cbrt(x))
end
function code(x)
	t_0 = cbrt(Float64(x + 1.0))
	tmp = 0.0
	if (cbrt(x) != 0.0)
		tmp = Float64(Float64(-(-1.0)) / fma(cbrt(x), Float64(t_0 + cbrt(x)), (t_0 ^ 2.0)));
	else
		tmp = Float64(t_0 - cbrt(x));
	end
	return tmp
end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
code[x_] := Block[{t$95$0 = N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision]}, If[Unequal[N[Power[x, 1/3], $MachinePrecision], 0.0], N[((--1.0) / N[(N[Power[x, 1/3], $MachinePrecision] * N[(t$95$0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]]]
\sqrt[3]{x + 1} - \sqrt[3]{x}
\begin{array}{l}
t_0 := \sqrt[3]{x + 1}\\
\mathbf{if}\;\sqrt[3]{x} \ne 0:\\
\;\;\;\;\frac{--1}{\mathsf{fma}\left(\sqrt[3]{x}, t_0 + \sqrt[3]{x}, {t_0}^{2}\right)}\\

\mathbf{else}:\\
\;\;\;\;t_0 - \sqrt[3]{x}\\


\end{array}

Error

Derivation

  1. Initial program 29.9

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

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\sqrt[3]{x} \ne 0:\\ \;\;\;\;\frac{\left(x + 1\right) - x}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, \sqrt[3]{{\left(x + 1\right)}^{2}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{x + 1} - \sqrt[3]{x}\\ } \end{array}} \]
  3. Applied egg-rr15.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sqrt[3]{x} \ne 0:\\ \;\;\;\;\frac{\color{blue}{--1}}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, \sqrt[3]{{\left(x + 1\right)}^{2}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{x + 1} - \sqrt[3]{x}\\ \end{array} \]
  4. Applied egg-rr0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sqrt[3]{x} \ne 0:\\ \;\;\;\;\frac{--1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, \color{blue}{{\left(\sqrt[3]{x + 1}\right)}^{2}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{x + 1} - \sqrt[3]{x}\\ \end{array} \]

Alternatives

Alternative 1
Error12.9
Cost45964
\[\begin{array}{l} t_0 := \sqrt[3]{x} \ne 0\\ t_1 := \sqrt[3]{1 + x}\\ t_2 := \sqrt[3]{x + 1}\\ t_3 := \begin{array}{l} \mathbf{if}\;t_0:\\ \;\;\;\;\frac{--1}{\sqrt[3]{x} \cdot \left(t_2 + \sqrt[3]{x}\right) + 1}\\ \mathbf{else}:\\ \;\;\;\;t_2 - \sqrt[3]{x}\\ \end{array}\\ \mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{+154}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;t_0:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_1 + \sqrt[3]{x}, \sqrt[3]{{\left(1 + x\right)}^{2}}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1 - \sqrt[3]{x}\\ \end{array}\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 2
Error24.5
Cost40140
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ t_1 := \sqrt[3]{-x}\\ t_2 := \sqrt[3]{x + 1}\\ t_3 := \begin{array}{l} \mathbf{if}\;\sqrt[3]{x} \ne 0:\\ \;\;\;\;\frac{--1}{\sqrt[3]{x} \cdot \left(t_2 + \sqrt[3]{x}\right) + 1}\\ \mathbf{else}:\\ \;\;\;\;t_2 - \sqrt[3]{x}\\ \end{array}\\ \mathbf{if}\;x \leq -9 \cdot 10^{+15}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 9 \cdot 10^{+15}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;t_1 \ne 0:\\ \;\;\;\;\frac{\left(1 + x\right) - x}{\sqrt[3]{{\left(1 + x\right)}^{2}} + t_1 \cdot \left(t_1 - t_0\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0 - \sqrt[3]{x}\\ \end{array}\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 3
Error24.5
Cost40076
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ t_1 := t_0 - \sqrt[3]{x}\\ t_2 := \begin{array}{l} \mathbf{if}\;\sqrt[3]{x} \ne 0:\\ \;\;\;\;\frac{--1}{\sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right) + 1}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{if}\;x \leq -9 \cdot 10^{+15}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 9 \cdot 10^{+15}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;\sqrt[3]{-x} \ne 0:\\ \;\;\;\;\frac{\left(x + 1\right) - x}{\left(\sqrt[3]{{\left(x + 1\right)}^{2}} + \sqrt[3]{x \cdot x}\right) - \left(-\sqrt[3]{\mathsf{fma}\left(x, x, x\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error24.5
Cost40076
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ t_1 := t_0 - \sqrt[3]{x}\\ t_2 := \begin{array}{l} \mathbf{if}\;\sqrt[3]{x} \ne 0:\\ \;\;\;\;\frac{--1}{\sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right) + 1}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{if}\;x \leq -9 \cdot 10^{+15}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 9 \cdot 10^{+15}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;\sqrt[3]{-x} \ne 0:\\ \;\;\;\;\frac{\left(x + 1\right) - x}{\left({t_0}^{2} + \sqrt[3]{x \cdot x}\right) - \left(-\sqrt[3]{\mathsf{fma}\left(x, x, x\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Error24.5
Cost33804
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ t_1 := \begin{array}{l} \mathbf{if}\;\sqrt[3]{x} \ne 0:\\ \;\;\;\;\frac{--1}{\sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right) + 1}\\ \mathbf{else}:\\ \;\;\;\;t_0 - \sqrt[3]{x}\\ \end{array}\\ \mathbf{if}\;x \leq -9 \cdot 10^{+15}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 9 \cdot 10^{+15}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;\sqrt[3]{-x} \ne 0:\\ \;\;\;\;\frac{\left(1 + x\right) - x}{\sqrt[3]{x \cdot x} + \left(\sqrt[3]{{\left(1 + x\right)}^{2}} - \left(-\sqrt[3]{\left(1 + x\right) \cdot x}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{1 + x} - \sqrt[3]{x}\\ \end{array}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error26.4
Cost26500
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ \mathbf{if}\;\sqrt[3]{x} \ne 0:\\ \;\;\;\;\frac{--1}{\sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right) + 1}\\ \mathbf{else}:\\ \;\;\;\;t_0 - \sqrt[3]{x}\\ \end{array} \]
Alternative 7
Error29.9
Cost26048
\[{\left({\left(\sqrt[3]{x + 1} - \sqrt[3]{x}\right)}^{3}\right)}^{0.3333333333333333} \]
Alternative 8
Error29.9
Cost13120
\[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
Alternative 9
Error31.6
Cost6592
\[1 - \sqrt[3]{x} \]
Alternative 10
Error61.7
Cost64
\[0 \]
Alternative 11
Error32.1
Cost64
\[1 \]

Error

Reproduce

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