?

Average Error: 30.1 → 0.6
Time: 9.7s
Precision: binary64
Cost: 91008

?

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

Error?

Derivation?

  1. Initial program 30.1

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

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

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

    [Start]29.5

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

    associate-*r/ [=>]29.5

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

    *-rgt-identity [=>]29.5

    \[ \frac{\color{blue}{\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)} \]

    +-commutative [=>]29.5

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

    associate--l+ [=>]0.5

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

    +-inverses [=>]0.5

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

    metadata-eval [=>]0.5

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

    +-commutative [=>]0.5

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

    fma-def [=>]0.5

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

    +-commutative [=>]0.5

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

    +-commutative [=>]0.5

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

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

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

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

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

Alternatives

Alternative 1
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 2
Error15.2
Cost33101
\[\begin{array}{l} t_0 := \sqrt[3]{x} + \sqrt[3]{x + 1}\\ \mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_0, 1\right)}\\ \mathbf{elif}\;x \leq -1 \lor \neg \left(x \leq 33000000\right):\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_0, \sqrt[3]{x \cdot x}\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{log1p}\left(x\right) \cdot 0.3333333333333333} - \sqrt[3]{x}\\ \end{array} \]
Alternative 3
Error8.2
Cost33032
\[\begin{array}{l} t_0 := \sqrt[3]{x} + \sqrt[3]{x + 1}\\ \mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_0, 1\right)}\\ \mathbf{elif}\;x \leq -1:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_0, \sqrt[3]{x \cdot x}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_0, {\left(x + 1\right)}^{0.6666666666666666}\right)}\\ \end{array} \]
Alternative 4
Error25.2
Cost32904
\[\begin{array}{l} t_0 := \sqrt[3]{x + 1}\\ \mathbf{if}\;x \leq -9.5 \cdot 10^{+14}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, 1\right)}\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{+15}:\\ \;\;\;\;\sqrt[3]{\frac{1 + {x}^{3}}{1 + \left(x \cdot x - x\right)}} - \sqrt[3]{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + 1, {t_0}^{2}\right)}\\ \end{array} \]
Alternative 5
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 6
Error25.2
Cost32840
\[\begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{+14}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{x + 1}, 1\right)}\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{+15}:\\ \;\;\;\;\sqrt[3]{\frac{1 + {x}^{3}}{1 + \left(x \cdot x - x\right)}} - \sqrt[3]{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + 1, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)}\\ \end{array} \]
Alternative 7
Error25.2
Cost26441
\[\begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{+14} \lor \neg \left(x \leq 1.1 \cdot 10^{+15}\right):\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{x + 1}, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{1 + {x}^{3}}{1 + \left(x \cdot x - x\right)}} - \sqrt[3]{x}\\ \end{array} \]
Alternative 8
Error30.1
Cost25920
\[e^{\log \left(\sqrt[3]{x + 1} - \sqrt[3]{x}\right)} \]
Alternative 9
Error30.1
Cost13120
\[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
Alternative 10
Error31.7
Cost6592
\[1 - \sqrt[3]{x} \]
Alternative 11
Error61.7
Cost64
\[0 \]
Alternative 12
Error32.2
Cost64
\[1 \]

Error

Reproduce?

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