Average Error: 29.2 → 8.8
Time: 1.1min
Precision: binary64
Cost: 27138
\[\sqrt[3]{x + 1} - \sqrt[3]{x}\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \leq -0.9930234061643127:\\
\;\;\;\;\sqrt[3]{\left(\frac{0.037037037037037035}{x \cdot x} - \frac{0.037037037037037035}{{x}^{3}}\right) + \frac{0.03292181069958848}{{x}^{4}}}\\
\mathbf{elif}\;x \leq 5.878760985559579 \cdot 10^{-23}:\\
\;\;\;\;{\left(x + 1\right)}^{0.3333333333333333} - \sqrt[3]{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{x}^{0.6666666666666666} + \sqrt[3]{x + 1} \cdot \left(\sqrt[3]{x} + \sqrt[3]{x + 1}\right)}\\
\end{array}\]
\sqrt[3]{x + 1} - \sqrt[3]{x}↓
\begin{array}{l}
\mathbf{if}\;x \leq -0.9930234061643127:\\
\;\;\;\;\sqrt[3]{\left(\frac{0.037037037037037035}{x \cdot x} - \frac{0.037037037037037035}{{x}^{3}}\right) + \frac{0.03292181069958848}{{x}^{4}}}\\
\mathbf{elif}\;x \leq 5.878760985559579 \cdot 10^{-23}:\\
\;\;\;\;{\left(x + 1\right)}^{0.3333333333333333} - \sqrt[3]{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{x}^{0.6666666666666666} + \sqrt[3]{x + 1} \cdot \left(\sqrt[3]{x} + \sqrt[3]{x + 1}\right)}\\
\end{array}(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (cbrt x)))
↓
(FPCore (x)
:precision binary64
(if (<= x -0.9930234061643127)
(cbrt
(+
(- (/ 0.037037037037037035 (* x x)) (/ 0.037037037037037035 (pow x 3.0)))
(/ 0.03292181069958848 (pow x 4.0))))
(if (<= x 5.878760985559579e-23)
(- (pow (+ x 1.0) 0.3333333333333333) (cbrt x))
(/
1.0
(+
(pow x 0.6666666666666666)
(* (cbrt (+ x 1.0)) (+ (cbrt x) (cbrt (+ x 1.0)))))))))double code(double x) {
return cbrt(x + 1.0) - cbrt(x);
}
↓
double code(double x) {
double tmp;
if (x <= -0.9930234061643127) {
tmp = cbrt(((0.037037037037037035 / (x * x)) - (0.037037037037037035 / pow(x, 3.0))) + (0.03292181069958848 / pow(x, 4.0)));
} else if (x <= 5.878760985559579e-23) {
tmp = pow((x + 1.0), 0.3333333333333333) - cbrt(x);
} else {
tmp = 1.0 / (pow(x, 0.6666666666666666) + (cbrt(x + 1.0) * (cbrt(x) + cbrt(x + 1.0))));
}
return tmp;
}
Try it out
Enter valid numbers for all inputs
Alternatives
| Alternative 1 |
|---|
| Error | 9.1 |
|---|
| Cost | 20738 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -0.9930234061643127:\\
\;\;\;\;\sqrt[3]{\left(\frac{0.037037037037037035}{x \cdot x} - \frac{0.037037037037037035}{{x}^{3}}\right) + \frac{0.03292181069958848}{{x}^{4}}}\\
\mathbf{elif}\;x \leq 3765.9527111249768:\\
\;\;\;\;{\left(x + 1\right)}^{0.3333333333333333} - \sqrt[3]{x}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\frac{0.12962962962962962}{x \cdot x} + \frac{-0.3333333333333333}{x}\right) + \log \left(0.3333333333333333 \cdot {x}^{-0.6666666666666666}\right)}\\
\end{array}\]
| Alternative 2 |
|---|
| Error | 9.2 |
|---|
| Cost | 20738 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -0.9930234061643127:\\
\;\;\;\;\sqrt[3]{\frac{0.037037037037037035}{x \cdot x} - \frac{0.037037037037037035}{{x}^{3}}}\\
\mathbf{elif}\;x \leq 3765.9527111249768:\\
\;\;\;\;{\left(x + 1\right)}^{0.3333333333333333} - \sqrt[3]{x}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\frac{0.12962962962962962}{x \cdot x} + \frac{-0.3333333333333333}{x}\right) + \log \left(0.3333333333333333 \cdot {x}^{-0.6666666666666666}\right)}\\
\end{array}\]
| Alternative 3 |
|---|
| Error | 9.1 |
|---|
| Cost | 20354 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -152611.9892781795:\\
\;\;\;\;\sqrt[3]{\frac{0.037037037037037035}{x \cdot x} - \frac{0.037037037037037035}{{x}^{3}}}\\
\mathbf{elif}\;x \leq 120987.24171378431:\\
\;\;\;\;\sqrt[3]{x + 1} - \sqrt[3]{x}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{-0.3333333333333333}{x} + \log \left(0.3333333333333333 \cdot {x}^{-0.6666666666666666}\right)}\\
\end{array}\]
| Alternative 4 |
|---|
| Error | 9.2 |
|---|
| Cost | 20098 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -152611.9892781795:\\
\;\;\;\;\sqrt[3]{\frac{0.037037037037037035}{x \cdot x} - \frac{0.037037037037037035}{{x}^{3}}}\\
\mathbf{elif}\;x \leq 29940083.16976061:\\
\;\;\;\;\sqrt[3]{x + 1} - \sqrt[3]{x}\\
\mathbf{else}:\\
\;\;\;\;e^{\log \left(0.3333333333333333 \cdot {x}^{-0.6666666666666666}\right)}\\
\end{array}\]
| Alternative 5 |
|---|
| Error | 15.0 |
|---|
| Cost | 13768 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -152611.9892781795 \lor \neg \left(x \leq 124502.47285005522\right):\\
\;\;\;\;\sqrt[3]{\frac{0.037037037037037035}{x \cdot x} - \frac{0.037037037037037035}{{x}^{3}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{x + 1} - \sqrt[3]{x}\\
\end{array}\]
| Alternative 6 |
|---|
| Error | 15.2 |
|---|
| Cost | 13448 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -27030370.47069278 \lor \neg \left(x \leq 29940083.16976061\right):\\
\;\;\;\;\sqrt[3]{\frac{0.037037037037037035}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{x + 1} - \sqrt[3]{x}\\
\end{array}\]
| Alternative 7 |
|---|
| Error | 15.8 |
|---|
| Cost | 7432 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.044081576734279 \lor \neg \left(x \leq 1.0350733902106042\right):\\
\;\;\;\;\sqrt[3]{\frac{0.037037037037037035}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \sqrt[3]{x}\right) + x \cdot \left(0.3333333333333333 + x \cdot -0.1111111111111111\right)\\
\end{array}\]
| Alternative 8 |
|---|
| Error | 15.8 |
|---|
| Cost | 7432 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.044081576734279 \lor \neg \left(x \leq 1.0350733902106042\right):\\
\;\;\;\;\sqrt[3]{\frac{0.037037037037037035}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(0.3333333333333333 + x \cdot -0.1111111111111111\right)\right) - \sqrt[3]{x}\\
\end{array}\]
| Alternative 9 |
|---|
| Error | 15.9 |
|---|
| Cost | 7176 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.044081576734279 \lor \neg \left(x \leq 1.0012719199727653\right):\\
\;\;\;\;\sqrt[3]{\frac{0.037037037037037035}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \sqrt[3]{x}\right) + x \cdot 0.3333333333333333\\
\end{array}\]
| Alternative 10 |
|---|
| Error | 15.9 |
|---|
| Cost | 7176 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.044081576734279 \lor \neg \left(x \leq 1.0012719199727653\right):\\
\;\;\;\;\sqrt[3]{\frac{0.037037037037037035}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot 0.3333333333333333\right) - \sqrt[3]{x}\\
\end{array}\]
| Alternative 11 |
|---|
| Error | 16.2 |
|---|
| Cost | 7048 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -0.9930234061643127 \lor \neg \left(x \leq 0.46952640881826857\right):\\
\;\;\;\;\sqrt[3]{\frac{0.037037037037037035}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt[3]{x}\\
\end{array}\]
| Alternative 12 |
|---|
| Error | 30.9 |
|---|
| Cost | 6592 |
|---|
\[1 - \sqrt[3]{x}\]
| Alternative 13 |
|---|
| Error | 31.5 |
|---|
| Cost | 64 |
|---|
\[1\]
| Alternative 14 |
|---|
| Error | 61.7 |
|---|
| Cost | 64 |
|---|
\[0\]
Error

Time

Derivation
- Split input into 3 regimes
if x < -0.993023406164312727
Initial program 59.5
\[\sqrt[3]{x + 1} - \sqrt[3]{x}\]
- Using strategy
rm Applied add-cbrt-cube_binary64_79659.5
\[\leadsto \color{blue}{\sqrt[3]{\left(\left(\sqrt[3]{x + 1} - \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x + 1} - \sqrt[3]{x}\right)\right) \cdot \left(\sqrt[3]{x + 1} - \sqrt[3]{x}\right)}}\]
Simplified59.5
\[\leadsto \sqrt[3]{\color{blue}{{\left(\sqrt[3]{x + 1} - \sqrt[3]{x}\right)}^{3}}}\]
Taylor expanded around inf 31.6
\[\leadsto \sqrt[3]{\color{blue}{\left(0.037037037037037035 \cdot \frac{1}{{x}^{2}} + 0.03292181069958848 \cdot \frac{1}{{x}^{4}}\right) - 0.037037037037037035 \cdot \frac{1}{{x}^{3}}}}\]
Simplified31.6
\[\leadsto \sqrt[3]{\color{blue}{\frac{0.03292181069958848}{{x}^{4}} + \left(\frac{0.037037037037037035}{x \cdot x} - \frac{0.037037037037037035}{{x}^{3}}\right)}}\]
Simplified31.6
\[\leadsto \color{blue}{\sqrt[3]{\left(\frac{0.037037037037037035}{x \cdot x} - \frac{0.037037037037037035}{{x}^{3}}\right) + \frac{0.03292181069958848}{{x}^{4}}}}\]
if -0.993023406164312727 < x < 5.8787609855595787e-23
Initial program 0.0
\[\sqrt[3]{x + 1} - \sqrt[3]{x}\]
- Using strategy
rm Applied pow1/3_binary64_8420.0
\[\leadsto \color{blue}{{\left(x + 1\right)}^{0.3333333333333333}} - \sqrt[3]{x}\]
Simplified0.0
\[\leadsto \color{blue}{{\left(x + 1\right)}^{0.3333333333333333} - \sqrt[3]{x}}\]
if 5.8787609855595787e-23 < x
Initial program 55.3
\[\sqrt[3]{x + 1} - \sqrt[3]{x}\]
- Using strategy
rm Applied flip3--_binary64_76455.1
\[\leadsto \color{blue}{\frac{{\left(\sqrt[3]{x + 1}\right)}^{3} - {\left(\sqrt[3]{x}\right)}^{3}}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right)}}\]
Simplified1.0
\[\leadsto \frac{\color{blue}{1}}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right)}\]
Simplified4.2
\[\leadsto \frac{1}{\color{blue}{{x}^{0.6666666666666666} + \sqrt[3]{x + 1} \cdot \left(\sqrt[3]{x + 1} + \sqrt[3]{x}\right)}}\]
Simplified4.2
\[\leadsto \color{blue}{\frac{1}{{x}^{0.6666666666666666} + \sqrt[3]{x + 1} \cdot \left(\sqrt[3]{x + 1} + \sqrt[3]{x}\right)}}\]
- Recombined 3 regimes into one program.
Final simplification8.8
\[\leadsto \begin{array}{l}
\mathbf{if}\;x \leq -0.9930234061643127:\\
\;\;\;\;\sqrt[3]{\left(\frac{0.037037037037037035}{x \cdot x} - \frac{0.037037037037037035}{{x}^{3}}\right) + \frac{0.03292181069958848}{{x}^{4}}}\\
\mathbf{elif}\;x \leq 5.878760985559579 \cdot 10^{-23}:\\
\;\;\;\;{\left(x + 1\right)}^{0.3333333333333333} - \sqrt[3]{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{x}^{0.6666666666666666} + \sqrt[3]{x + 1} \cdot \left(\sqrt[3]{x} + \sqrt[3]{x + 1}\right)}\\
\end{array}\]
Reproduce
herbie shell --seed 2021040
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
(- (cbrt (+ x 1.0)) (cbrt x)))