?

Average Error: 30.0 → 0.6
Time: 10.6s
Precision: binary64
Cost: 52480

?

\[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ \frac{\mathsf{fma}\left(2, x, 1\right)}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, {t_0}^{2}\right)} \cdot \frac{1}{\mathsf{fma}\left(2, x, 1\right)} \end{array} \]
(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (cbrt x)))
(FPCore (x)
 :precision binary64
 (let* ((t_0 (cbrt (+ x 1.0))))
   (*
    (/ (fma 2.0 x 1.0) (fma (cbrt x) (+ (cbrt x) t_0) (pow t_0 2.0)))
    (/ 1.0 (fma 2.0 x 1.0)))))
double code(double x) {
	return cbrt((x + 1.0)) - cbrt(x);
}
double code(double x) {
	double t_0 = cbrt((x + 1.0));
	return (fma(2.0, x, 1.0) / fma(cbrt(x), (cbrt(x) + t_0), pow(t_0, 2.0))) * (1.0 / fma(2.0, x, 1.0));
}
function code(x)
	return Float64(cbrt(Float64(x + 1.0)) - cbrt(x))
end
function code(x)
	t_0 = cbrt(Float64(x + 1.0))
	return Float64(Float64(fma(2.0, x, 1.0) / fma(cbrt(x), Float64(cbrt(x) + t_0), (t_0 ^ 2.0))) * Float64(1.0 / fma(2.0, x, 1.0)))
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]}, N[(N[(N[(2.0 * x + 1.0), $MachinePrecision] / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision] + N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(2.0 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\sqrt[3]{x + 1} - \sqrt[3]{x}
\begin{array}{l}
t_0 := \sqrt[3]{x + 1}\\
\frac{\mathsf{fma}\left(2, x, 1\right)}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, {t_0}^{2}\right)} \cdot \frac{1}{\mathsf{fma}\left(2, x, 1\right)}
\end{array}

Error?

Derivation?

  1. Initial program 30.0

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

    \[\leadsto \color{blue}{\log \left(1 + \mathsf{expm1}\left(\sqrt[3]{x + 1} - \sqrt[3]{x}\right)\right)} \]
  3. Applied egg-rr30.6

    \[\leadsto \color{blue}{\frac{{\left(1 + x\right)}^{2} - x \cdot x}{\left({\left(\sqrt[3]{1 + x}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)\right) \cdot \left(1 + \left(x + x\right)\right)}} \]
  4. Simplified12.7

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(2, x, 1\right) \cdot 1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left(\sqrt[3]{1 + x}\right)}^{2}\right) \cdot \mathsf{fma}\left(2, x, 1\right)}} \]
    Proof

    [Start]30.6

    \[ \frac{{\left(1 + x\right)}^{2} - x \cdot x}{\left({\left(\sqrt[3]{1 + x}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)\right) \cdot \left(1 + \left(x + x\right)\right)} \]

    unpow2 [=>]30.6

    \[ \frac{\color{blue}{\left(1 + x\right) \cdot \left(1 + x\right)} - x \cdot x}{\left({\left(\sqrt[3]{1 + x}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)\right) \cdot \left(1 + \left(x + x\right)\right)} \]

    difference-of-squares [=>]29.2

    \[ \frac{\color{blue}{\left(\left(1 + x\right) + x\right) \cdot \left(\left(1 + x\right) - x\right)}}{\left({\left(\sqrt[3]{1 + x}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)\right) \cdot \left(1 + \left(x + x\right)\right)} \]

    associate-+r+ [<=]29.2

    \[ \frac{\color{blue}{\left(1 + \left(x + x\right)\right)} \cdot \left(\left(1 + x\right) - x\right)}{\left({\left(\sqrt[3]{1 + x}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)\right) \cdot \left(1 + \left(x + x\right)\right)} \]

    associate-+r- [<=]12.7

    \[ \frac{\left(1 + \left(x + x\right)\right) \cdot \color{blue}{\left(1 + \left(x - x\right)\right)}}{\left({\left(\sqrt[3]{1 + x}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)\right) \cdot \left(1 + \left(x + x\right)\right)} \]

    +-commutative [=>]12.7

    \[ \frac{\left(1 + \left(x + x\right)\right) \cdot \color{blue}{\left(\left(x - x\right) + 1\right)}}{\left({\left(\sqrt[3]{1 + x}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)\right) \cdot \left(1 + \left(x + x\right)\right)} \]

    +-inverses [=>]12.7

    \[ \frac{\left(1 + \left(x + x\right)\right) \cdot \left(\color{blue}{0} + 1\right)}{\left({\left(\sqrt[3]{1 + x}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)\right) \cdot \left(1 + \left(x + x\right)\right)} \]

    metadata-eval [=>]12.7

    \[ \frac{\left(1 + \left(x + x\right)\right) \cdot \color{blue}{1}}{\left({\left(\sqrt[3]{1 + x}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)\right) \cdot \left(1 + \left(x + x\right)\right)} \]

    +-commutative [=>]12.7

    \[ \frac{\color{blue}{\left(\left(x + x\right) + 1\right)} \cdot 1}{\left({\left(\sqrt[3]{1 + x}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)\right) \cdot \left(1 + \left(x + x\right)\right)} \]

    count-2 [=>]12.7

    \[ \frac{\left(\color{blue}{2 \cdot x} + 1\right) \cdot 1}{\left({\left(\sqrt[3]{1 + x}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)\right) \cdot \left(1 + \left(x + x\right)\right)} \]

    fma-def [=>]12.7

    \[ \frac{\color{blue}{\mathsf{fma}\left(2, x, 1\right)} \cdot 1}{\left({\left(\sqrt[3]{1 + x}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)\right) \cdot \left(1 + \left(x + x\right)\right)} \]

    +-commutative [=>]12.7

    \[ \frac{\mathsf{fma}\left(2, x, 1\right) \cdot 1}{\color{blue}{\left(\sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right) + {\left(\sqrt[3]{1 + x}\right)}^{2}\right)} \cdot \left(1 + \left(x + x\right)\right)} \]

    fma-def [=>]12.7

    \[ \frac{\mathsf{fma}\left(2, x, 1\right) \cdot 1}{\color{blue}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left(\sqrt[3]{1 + x}\right)}^{2}\right)} \cdot \left(1 + \left(x + x\right)\right)} \]

    +-commutative [=>]12.7

    \[ \frac{\mathsf{fma}\left(2, x, 1\right) \cdot 1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left(\sqrt[3]{1 + x}\right)}^{2}\right) \cdot \color{blue}{\left(\left(x + x\right) + 1\right)}} \]

    count-2 [=>]12.7

    \[ \frac{\mathsf{fma}\left(2, x, 1\right) \cdot 1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left(\sqrt[3]{1 + x}\right)}^{2}\right) \cdot \left(\color{blue}{2 \cdot x} + 1\right)} \]

    fma-def [=>]12.7

    \[ \frac{\mathsf{fma}\left(2, x, 1\right) \cdot 1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left(\sqrt[3]{1 + x}\right)}^{2}\right) \cdot \color{blue}{\mathsf{fma}\left(2, x, 1\right)}} \]
  5. Applied egg-rr0.6

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(2, x, 1\right)}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{x + 1}, {\left(\sqrt[3]{x + 1}\right)}^{2}\right)} \cdot \frac{1}{\mathsf{fma}\left(2, x, 1\right)}} \]
  6. Final simplification0.6

    \[\leadsto \frac{\mathsf{fma}\left(2, x, 1\right)}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{x + 1}, {\left(\sqrt[3]{x + 1}\right)}^{2}\right)} \cdot \frac{1}{\mathsf{fma}\left(2, x, 1\right)} \]

Alternatives

Alternative 1
Error0.6
Cost46208
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ \frac{-1}{\frac{-1 + x \cdot -2}{\frac{\mathsf{fma}\left(2, x, 1\right)}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, {t_0}^{2}\right)}}} \end{array} \]
Alternative 2
Error0.6
Cost46208
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ \frac{\frac{-1}{\frac{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, {t_0}^{2}\right)}{\mathsf{fma}\left(2, x, 1\right)}}}{-1 + x \cdot -2} \end{array} \]
Alternative 3
Error0.5
Cost39168
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, {t_0}^{2}\right)} \end{array} \]
Alternative 4
Error7.4
Cost33160
\[\begin{array}{l} t_0 := \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \sqrt[3]{x + 1}\right)\\ \mathbf{if}\;x \leq -1.32 \cdot 10^{+154}:\\ \;\;\;\;\frac{1}{1 + t_0}\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{1}{t_0 + \sqrt[3]{{\left(x + 1\right)}^{2}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_0 + e^{\mathsf{log1p}\left(x\right) \cdot 0.6666666666666666}}\\ \end{array} \]
Alternative 5
Error0.5
Cost33024
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ \frac{1}{{t_0}^{2} + \frac{\sqrt[3]{x}}{\frac{1}{\sqrt[3]{x} + t_0}}} \end{array} \]
Alternative 6
Error14.0
Cost32964
\[\begin{array}{l} t_0 := \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \sqrt[3]{x + 1}\right)\\ \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{1}{1 + t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_0 + e^{\mathsf{log1p}\left(x\right) \cdot 0.6666666666666666}}\\ \end{array} \]
Alternative 7
Error0.5
Cost32896
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ \frac{1}{{t_0}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + t_0\right)} \end{array} \]
Alternative 8
Error25.2
Cost26632
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ \mathbf{if}\;x \leq -4.4 \cdot 10^{+14}:\\ \;\;\;\;\frac{1}{1 + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + t_0\right)}\\ \mathbf{elif}\;x \leq 9.2 \cdot 10^{+14}:\\ \;\;\;\;\frac{\sqrt[3]{\mathsf{fma}\left(x, x, -1\right)}}{\sqrt[3]{x + -1}} - \sqrt[3]{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{{t_0}^{2} + \sqrt[3]{x} \cdot \left(1 + \sqrt[3]{x}\right)}\\ \end{array} \]
Alternative 9
Error25.2
Cost26441
\[\begin{array}{l} \mathbf{if}\;x \leq -4.4 \cdot 10^{+14} \lor \neg \left(x \leq 9.2 \cdot 10^{+14}\right):\\ \;\;\;\;\frac{1}{1 + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \sqrt[3]{x + 1}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{\mathsf{fma}\left(x, x, -1\right)}}{\sqrt[3]{x + -1}} - \sqrt[3]{x}\\ \end{array} \]
Alternative 10
Error25.1
Cost26185
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ \mathbf{if}\;x \leq -2.15 \cdot 10^{+15} \lor \neg \left(x \leq 1.46 \cdot 10^{+15}\right):\\ \;\;\;\;\frac{1}{1 + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + t_0\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(t_0 - \sqrt[3]{x}\right)}\\ \end{array} \]
Alternative 11
Error25.1
Cost20169
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ \mathbf{if}\;x \leq -2.15 \cdot 10^{+15} \lor \neg \left(x \leq 1.46 \cdot 10^{+15}\right):\\ \;\;\;\;\frac{1}{1 + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + t_0\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0 - \sqrt[3]{x}\\ \end{array} \]
Alternative 12
Error30.0
Cost13120
\[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
Alternative 13
Error61.7
Cost64
\[0 \]
Alternative 14
Error32.1
Cost64
\[1 \]

Error

Reproduce?

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