?

Average Error: 29.6 → 0.4
Time: 1.3min
Precision: binary64
Cost: 34116

?

\[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
\[\begin{array}{l} t_0 := \sqrt[3]{x - -1}\\ \mathbf{if}\;t_0 \ne 0:\\ \;\;\;\;t_0 \cdot \frac{\frac{-1}{-1 - x}}{1 + \left(\sqrt[3]{x} \cdot \sqrt[3]{\frac{\frac{x}{x + 1}}{x + 1}} + \sqrt[3]{\frac{x}{1 + x}}\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 (!= t_0 0.0)
     (*
      t_0
      (/
       (/ -1.0 (- -1.0 x))
       (+
        1.0
        (+
         (* (cbrt x) (cbrt (/ (/ x (+ x 1.0)) (+ x 1.0))))
         (cbrt (/ x (+ 1.0 x)))))))
     (- 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 != 0.0) {
		tmp = t_0 * ((-1.0 / (-1.0 - x)) / (1.0 + ((cbrt(x) * cbrt(((x / (x + 1.0)) / (x + 1.0)))) + cbrt((x / (1.0 + x))))));
	} else {
		tmp = t_0 - cbrt(x);
	}
	return tmp;
}
public static double code(double x) {
	return Math.cbrt((x + 1.0)) - Math.cbrt(x);
}
public static double code(double x) {
	double t_0 = Math.cbrt((x - -1.0));
	double tmp;
	if (t_0 != 0.0) {
		tmp = t_0 * ((-1.0 / (-1.0 - x)) / (1.0 + ((Math.cbrt(x) * Math.cbrt(((x / (x + 1.0)) / (x + 1.0)))) + Math.cbrt((x / (1.0 + x))))));
	} else {
		tmp = t_0 - Math.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 (t_0 != 0.0)
		tmp = Float64(t_0 * Float64(Float64(-1.0 / Float64(-1.0 - x)) / Float64(1.0 + Float64(Float64(cbrt(x) * cbrt(Float64(Float64(x / Float64(x + 1.0)) / Float64(x + 1.0)))) + cbrt(Float64(x / Float64(1.0 + x)))))));
	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[t$95$0, 0.0], N[(t$95$0 * N[(N[(-1.0 / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[(N[Power[x, 1/3], $MachinePrecision] * N[Power[N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $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}\;t_0 \ne 0:\\
\;\;\;\;t_0 \cdot \frac{\frac{-1}{-1 - x}}{1 + \left(\sqrt[3]{x} \cdot \sqrt[3]{\frac{\frac{x}{x + 1}}{x + 1}} + \sqrt[3]{\frac{x}{1 + x}}\right)}\\

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


\end{array}

Error?

Derivation?

  1. Initial program 29.6

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

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\sqrt[3]{x + 1} \ne 0:\\ \;\;\;\;\sqrt[3]{x + 1} \cdot \left(1 + \sqrt[3]{\frac{x}{-1 - x}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{x + 1} - \sqrt[3]{x}\\ } \end{array}} \]
  3. Simplified29.6

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;\sqrt[3]{x - -1} \ne 0:\\ \;\;\;\;\sqrt[3]{x - -1} \cdot \left(\sqrt[3]{\frac{x}{-1 - x}} - -1\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{x - -1} - \sqrt[3]{x}\\ } \end{array}} \]
    Proof
  4. Applied egg-rr29.5

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

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

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

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

Alternatives

Alternative 1
Error0.4
Cost45960
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ t_1 := \sqrt[3]{x - -1}\\ \mathbf{if}\;t_0 - \sqrt[3]{x} \leq 0.0002:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;t_1 \ne 0:\\ \;\;\;\;t_1 \cdot \frac{\frac{-1}{-1 - x}}{1 + \left(\left(1 + \mathsf{fma}\left(\frac{1}{x \cdot x}, 0.5555555555555556, \frac{-0.6666666666666666}{x}\right)\right) + \sqrt[3]{\frac{x}{1 + x}}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1 - \sqrt[3]{x}\\ \end{array}\\ \mathbf{else}:\\ \;\;\;\;t_0 - \begin{array}{l} \mathbf{if}\;\sqrt[3]{x} \ne 0:\\ \;\;\;\;\frac{\sqrt[3]{{x}^{2}} - 0}{\sqrt[3]{x}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{x}\\ \end{array}\\ \end{array} \]
Alternative 2
Error0.4
Cost40904
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1} - \sqrt[3]{x}\\ t_1 := \sqrt[3]{x - -1}\\ \mathbf{if}\;t_0 \leq 0.0002:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;t_1 \ne 0:\\ \;\;\;\;t_1 \cdot \frac{\frac{-1}{-1 - x}}{1 + \left(\left(1 + \mathsf{fma}\left(\frac{1}{x \cdot x}, 0.5555555555555556, \frac{-0.6666666666666666}{x}\right)\right) + \sqrt[3]{\frac{x}{1 + x}}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1 - \sqrt[3]{x}\\ \end{array}\\ \mathbf{else}:\\ \;\;\;\;{\left({t_0}^{3}\right)}^{0.3333333333333333}\\ \end{array} \]
Alternative 3
Error0.4
Cost33796
\[\begin{array}{l} t_0 := \sqrt[3]{x - -1}\\ \mathbf{if}\;t_0 \ne 0:\\ \;\;\;\;t_0 \cdot \frac{\frac{-1}{-1 - x}}{1 + \left(\sqrt[3]{{\left(\frac{x}{-1 - x}\right)}^{2}} + \sqrt[3]{\frac{x}{1 + x}}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0 - \sqrt[3]{x}\\ \end{array} \]
Alternative 4
Error1.0
Cost33604
\[\begin{array}{l} t_0 := -\sqrt[3]{x}\\ \mathbf{if}\;t_0 \ne 0:\\ \;\;\;\;t_0 \cdot \frac{0 + \frac{1}{x}}{\mathsf{fma}\left(\sqrt[3]{-1 - \frac{1}{x}}, \sqrt[3]{\frac{x - -1}{x}} - -1, -1\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{x + 1} - \sqrt[3]{x}\\ \end{array} \]
Alternative 5
Error0.6
Cost32968
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1} - \sqrt[3]{x}\\ t_1 := \sqrt[3]{x - -1}\\ \mathbf{if}\;t_0 \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;t_1 \ne 0:\\ \;\;\;\;t_1 \cdot \left(0 + \frac{0.3333333333333333}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1 - \sqrt[3]{x}\\ \end{array}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error0.5
Cost26312
\[\begin{array}{l} t_0 := \sqrt[3]{x - -1}\\ t_1 := t_0 - \sqrt[3]{x}\\ t_2 := t_0 \ne 0\\ \mathbf{if}\;x \leq -24000000:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;t_2:\\ \;\;\;\;t_0 \cdot \frac{\frac{-1}{-1 - x}}{1 + \left(1 + \sqrt[3]{\frac{x}{1 + x}}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{elif}\;x \leq 145000:\\ \;\;\;\;{\left({\left(\sqrt[3]{x + 1} - \sqrt[3]{x}\right)}^{3}\right)}^{0.3333333333333333}\\ \mathbf{elif}\;t_2:\\ \;\;\;\;t_0 \cdot \left(0.3333333333333333 \cdot \frac{1}{x} + -0.2222222222222222 \cdot {x}^{-2}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error0.5
Cost20808
\[\begin{array}{l} t_0 := \sqrt[3]{x - -1}\\ t_1 := t_0 - \sqrt[3]{x}\\ t_2 := t_0 \ne 0\\ \mathbf{if}\;x \leq -24000000:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;t_2:\\ \;\;\;\;t_0 \cdot \frac{\frac{-1}{-1 - x}}{1 + \left(1 + \sqrt[3]{\frac{x}{1 + x}}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{elif}\;x \leq 145000:\\ \;\;\;\;\sqrt[3]{x + 1} - \sqrt[3]{x}\\ \mathbf{elif}\;t_2:\\ \;\;\;\;t_0 \cdot \left(0.3333333333333333 \cdot \frac{1}{x} + -0.2222222222222222 \cdot {x}^{-2}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error0.5
Cost20620
\[\begin{array}{l} t_0 := \sqrt[3]{x - -1}\\ t_1 := t_0 \ne 0\\ t_2 := t_0 - \sqrt[3]{x}\\ \mathbf{if}\;x \leq -43000000:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;t_1:\\ \;\;\;\;t_0 \cdot \left(0 + \frac{0.3333333333333333}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array}\\ \mathbf{elif}\;x \leq 145000:\\ \;\;\;\;\sqrt[3]{x + 1} - \sqrt[3]{x}\\ \mathbf{elif}\;t_1:\\ \;\;\;\;t_0 \cdot \left(0.3333333333333333 \cdot \frac{1}{x} + -0.2222222222222222 \cdot {x}^{-2}\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 9
Error29.6
Cost13120
\[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
Alternative 10
Error61.7
Cost64
\[0 \]
Alternative 11
Error31.9
Cost64
\[1 \]

Error

Reproduce?

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