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

Error

Derivation

  1. Initial program 29.6

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

    \[\leadsto \color{blue}{\frac{\left(x + 1\right) - x}{{\left(\sqrt[3]{x + 1}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x + 1} + \sqrt[3]{x}\right)}} \]
  3. Taylor expanded in x around 0 0.5

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

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

    \[\leadsto \frac{1}{{\left(\sqrt[3]{x + 1}\right)}^{2} + \color{blue}{\frac{\sqrt[3]{x}}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} - \sqrt[3]{x + 1}, {\left(\sqrt[3]{x + 1}\right)}^{2}\right)} \cdot \left(x + \left(x + 1\right)\right)}} \]
    Proof
    (*.f64 (/.f64 (cbrt.f64 x) (fma.f64 (cbrt.f64 x) (-.f64 (cbrt.f64 x) (cbrt.f64 (+.f64 x 1))) (pow.f64 (cbrt.f64 (+.f64 x 1)) 2))) (+.f64 x (+.f64 x 1))): 0 points increase in error, 0 points decrease in error
    (*.f64 (/.f64 (cbrt.f64 x) (Rewrite<= fma-def_binary64 (+.f64 (*.f64 (cbrt.f64 x) (-.f64 (cbrt.f64 x) (cbrt.f64 (+.f64 x 1)))) (pow.f64 (cbrt.f64 (+.f64 x 1)) 2)))) (+.f64 x (+.f64 x 1))): 0 points increase in error, 0 points decrease in error
    (*.f64 (/.f64 (cbrt.f64 x) (Rewrite<= +-commutative_binary64 (+.f64 (pow.f64 (cbrt.f64 (+.f64 x 1)) 2) (*.f64 (cbrt.f64 x) (-.f64 (cbrt.f64 x) (cbrt.f64 (+.f64 x 1))))))) (+.f64 x (+.f64 x 1))): 0 points increase in error, 0 points decrease in error
    (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 (cbrt.f64 x) (+.f64 x (+.f64 x 1))) (+.f64 (pow.f64 (cbrt.f64 (+.f64 x 1)) 2) (*.f64 (cbrt.f64 x) (-.f64 (cbrt.f64 x) (cbrt.f64 (+.f64 x 1))))))): 51 points increase in error, 17 points decrease in error
    (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 (+.f64 x (+.f64 x 1)) (cbrt.f64 x))) (+.f64 (pow.f64 (cbrt.f64 (+.f64 x 1)) 2) (*.f64 (cbrt.f64 x) (-.f64 (cbrt.f64 x) (cbrt.f64 (+.f64 x 1)))))): 0 points increase in error, 0 points decrease in error
  6. Final simplification0.3

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

Alternatives

Alternative 1
Error0.3
Cost52928
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ t_1 := {t_0}^{2}\\ \frac{1}{t_1 + \frac{\sqrt[3]{x}}{\frac{t_1 + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} - t_0\right)}{x + \left(1 + x\right)}}} \end{array} \]
Alternative 2
Error0.5
Cost39168
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_0 + \sqrt[3]{x}, {t_0}^{2}\right)} \end{array} \]
Alternative 3
Error6.9
Cost33160
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ t_1 := \sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right)\\ \mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, 1 + \sqrt[3]{x}, {t_0}^{2}\right)}\\ \mathbf{elif}\;x \leq 1.32 \cdot 10^{+154}:\\ \;\;\;\;\frac{1}{t_1 + \sqrt[3]{{\left(1 + x\right)}^{2}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_1 + e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}}\\ \end{array} \]
Alternative 4
Error7.7
Cost33096
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ \mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, 1 + \sqrt[3]{x}, {t_0}^{2}\right)}\\ \mathbf{elif}\;x \leq -1:\\ \;\;\;\;0.3333333333333333 \cdot \sqrt[3]{\frac{1}{x \cdot x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right) + e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}}\\ \end{array} \]
Alternative 5
Error0.5
Cost32896
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ \frac{1}{{t_0}^{2} + \sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right)} \end{array} \]
Alternative 6
Error14.2
Cost32772
\[\begin{array}{l} t_0 := 0.3333333333333333 \cdot \sqrt[3]{\frac{1}{x \cdot x}}\\ t_1 := \sqrt[3]{1 + x}\\ \mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, 1 + \sqrt[3]{x}, {t_1}^{2}\right)}\\ \mathbf{elif}\;x \leq -18000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 41000000:\\ \;\;\;\;t_1 - \sqrt[3]{x}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error15.3
Cost26308
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x} - \sqrt[3]{x}\\ \mathbf{if}\;t_0 \leq 4 \cdot 10^{-6}:\\ \;\;\;\;0.3333333333333333 \cdot \sqrt[3]{\frac{1}{x \cdot x}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error17.6
Cost7112
\[\begin{array}{l} t_0 := 0.3333333333333333 \cdot \sqrt[3]{\frac{1}{x \cdot x}}\\ \mathbf{if}\;x \leq -1.12:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.19:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error61.7
Cost64
\[0 \]
Alternative 10
Error31.8
Cost64
\[1 \]

Error

Reproduce

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