| Alternative 1 | |
|---|---|
| Error | 1.0 |
| Cost | 39684 |
(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (cbrt x)))
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(if (<= x -5e+106)
(/ (cbrt (/ 0.037037037037037035 x)) (cbrt x))
(if (<= x 5e+138)
(/ 1.0 (+ (* (+ (cbrt x) t_0) t_0) (cbrt (* x x))))
(/ 1.0 (/ (pow (cbrt x) 2.0) 0.3333333333333333))))))double code(double x) {
return cbrt((x + 1.0)) - cbrt(x);
}
double code(double x) {
double t_0 = cbrt((1.0 + x));
double tmp;
if (x <= -5e+106) {
tmp = cbrt((0.037037037037037035 / x)) / cbrt(x);
} else if (x <= 5e+138) {
tmp = 1.0 / (((cbrt(x) + t_0) * t_0) + cbrt((x * x)));
} else {
tmp = 1.0 / (pow(cbrt(x), 2.0) / 0.3333333333333333);
}
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((1.0 + x));
double tmp;
if (x <= -5e+106) {
tmp = Math.cbrt((0.037037037037037035 / x)) / Math.cbrt(x);
} else if (x <= 5e+138) {
tmp = 1.0 / (((Math.cbrt(x) + t_0) * t_0) + Math.cbrt((x * x)));
} else {
tmp = 1.0 / (Math.pow(Math.cbrt(x), 2.0) / 0.3333333333333333);
}
return tmp;
}
function code(x) return Float64(cbrt(Float64(x + 1.0)) - cbrt(x)) end
function code(x) t_0 = cbrt(Float64(1.0 + x)) tmp = 0.0 if (x <= -5e+106) tmp = Float64(cbrt(Float64(0.037037037037037035 / x)) / cbrt(x)); elseif (x <= 5e+138) tmp = Float64(1.0 / Float64(Float64(Float64(cbrt(x) + t_0) * t_0) + cbrt(Float64(x * x)))); else tmp = Float64(1.0 / Float64((cbrt(x) ^ 2.0) / 0.3333333333333333)); 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[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[x, -5e+106], N[(N[Power[N[(0.037037037037037035 / x), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5e+138], N[(1.0 / N[(N[(N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] + N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision] / 0.3333333333333333), $MachinePrecision]), $MachinePrecision]]]]
\sqrt[3]{x + 1} - \sqrt[3]{x}
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\mathbf{if}\;x \leq -5 \cdot 10^{+106}:\\
\;\;\;\;\frac{\sqrt[3]{\frac{0.037037037037037035}{x}}}{\sqrt[3]{x}}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+138}:\\
\;\;\;\;\frac{1}{\left(\sqrt[3]{x} + t_0\right) \cdot t_0 + \sqrt[3]{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{{\left(\sqrt[3]{x}\right)}^{2}}{0.3333333333333333}}\\
\end{array}
Results
if x < -4.9999999999999998e106Initial program 61.1
Applied egg-rr64.0
Taylor expanded in x around inf 49.2
Simplified48.0
[Start]49.2 | \[ 0.3333333333333333 \cdot {\left(\frac{1}{{x}^{2}}\right)}^{0.3333333333333333}
\] |
|---|---|
unpow1/3 [=>]48.0 | \[ 0.3333333333333333 \cdot \color{blue}{\sqrt[3]{\frac{1}{{x}^{2}}}}
\] |
unpow2 [=>]48.0 | \[ 0.3333333333333333 \cdot \sqrt[3]{\frac{1}{\color{blue}{x \cdot x}}}
\] |
Applied egg-rr61.1
Simplified48.0
[Start]61.1 | \[ e^{\mathsf{log1p}\left(\sqrt[3]{{x}^{-2}} \cdot 0.3333333333333333\right)} - 1
\] |
|---|---|
expm1-def [=>]46.8 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{{x}^{-2}} \cdot 0.3333333333333333\right)\right)}
\] |
expm1-log1p [=>]46.8 | \[ \color{blue}{\sqrt[3]{{x}^{-2}} \cdot 0.3333333333333333}
\] |
rem-cbrt-cube [<=]47.0 | \[ \color{blue}{\sqrt[3]{{\left(\sqrt[3]{{x}^{-2}} \cdot 0.3333333333333333\right)}^{3}}}
\] |
cube-prod [=>]47.1 | \[ \sqrt[3]{\color{blue}{{\left(\sqrt[3]{{x}^{-2}}\right)}^{3} \cdot {0.3333333333333333}^{3}}}
\] |
rem-cube-cbrt [=>]47.0 | \[ \sqrt[3]{\color{blue}{{x}^{-2}} \cdot {0.3333333333333333}^{3}}
\] |
rem-exp-log [<=]48.0 | \[ \sqrt[3]{\color{blue}{e^{\log \left({x}^{-2}\right)}} \cdot {0.3333333333333333}^{3}}
\] |
log-pow [=>]64.0 | \[ \sqrt[3]{e^{\color{blue}{-2 \cdot \log x}} \cdot {0.3333333333333333}^{3}}
\] |
metadata-eval [<=]64.0 | \[ \sqrt[3]{e^{\color{blue}{\left(-2\right)} \cdot \log x} \cdot {0.3333333333333333}^{3}}
\] |
distribute-lft-neg-in [<=]64.0 | \[ \sqrt[3]{e^{\color{blue}{-2 \cdot \log x}} \cdot {0.3333333333333333}^{3}}
\] |
exp-neg [=>]64.0 | \[ \sqrt[3]{\color{blue}{\frac{1}{e^{2 \cdot \log x}}} \cdot {0.3333333333333333}^{3}}
\] |
*-commutative [=>]64.0 | \[ \sqrt[3]{\frac{1}{e^{\color{blue}{\log x \cdot 2}}} \cdot {0.3333333333333333}^{3}}
\] |
exp-to-pow [=>]48.1 | \[ \sqrt[3]{\frac{1}{\color{blue}{{x}^{2}}} \cdot {0.3333333333333333}^{3}}
\] |
unpow2 [=>]48.1 | \[ \sqrt[3]{\frac{1}{\color{blue}{x \cdot x}} \cdot {0.3333333333333333}^{3}}
\] |
associate-*l/ [=>]48.1 | \[ \sqrt[3]{\color{blue}{\frac{1 \cdot {0.3333333333333333}^{3}}{x \cdot x}}}
\] |
metadata-eval [=>]48.0 | \[ \sqrt[3]{\frac{1 \cdot \color{blue}{0.037037037037037035}}{x \cdot x}}
\] |
metadata-eval [=>]48.0 | \[ \sqrt[3]{\frac{\color{blue}{0.037037037037037035}}{x \cdot x}}
\] |
Applied egg-rr0.9
if -4.9999999999999998e106 < x < 5.00000000000000016e138Initial program 15.9
Applied egg-rr15.0
Simplified0.3
[Start]15.0 | \[ \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/ [=>]15.0 | \[ \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 [=>]15.0 | \[ \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 [=>]15.0 | \[ \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.3 | \[ \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.3 | \[ \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.3 | \[ \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.3 | \[ \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.3 | \[ \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.3 | \[ \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.3 | \[ \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)}
\] |
Applied egg-rr0.3
Applied egg-rr0.3
if 5.00000000000000016e138 < x Initial program 61.0
Applied egg-rr61.0
Taylor expanded in x around inf 55.8
Simplified55.3
[Start]55.8 | \[ 0.3333333333333333 \cdot {\left(\frac{1}{{x}^{2}}\right)}^{0.3333333333333333}
\] |
|---|---|
unpow1/3 [=>]55.3 | \[ 0.3333333333333333 \cdot \color{blue}{\sqrt[3]{\frac{1}{{x}^{2}}}}
\] |
unpow2 [=>]55.3 | \[ 0.3333333333333333 \cdot \sqrt[3]{\frac{1}{\color{blue}{x \cdot x}}}
\] |
Applied egg-rr61.0
Simplified55.3
[Start]61.0 | \[ e^{\mathsf{log1p}\left(\sqrt[3]{{x}^{-2}} \cdot 0.3333333333333333\right)} - 1
\] |
|---|---|
expm1-def [=>]53.8 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{{x}^{-2}} \cdot 0.3333333333333333\right)\right)}
\] |
expm1-log1p [=>]53.8 | \[ \color{blue}{\sqrt[3]{{x}^{-2}} \cdot 0.3333333333333333}
\] |
rem-cbrt-cube [<=]54.1 | \[ \color{blue}{\sqrt[3]{{\left(\sqrt[3]{{x}^{-2}} \cdot 0.3333333333333333\right)}^{3}}}
\] |
cube-prod [=>]54.1 | \[ \sqrt[3]{\color{blue}{{\left(\sqrt[3]{{x}^{-2}}\right)}^{3} \cdot {0.3333333333333333}^{3}}}
\] |
rem-cube-cbrt [=>]54.0 | \[ \sqrt[3]{\color{blue}{{x}^{-2}} \cdot {0.3333333333333333}^{3}}
\] |
rem-exp-log [<=]54.5 | \[ \sqrt[3]{\color{blue}{e^{\log \left({x}^{-2}\right)}} \cdot {0.3333333333333333}^{3}}
\] |
log-pow [=>]54.5 | \[ \sqrt[3]{e^{\color{blue}{-2 \cdot \log x}} \cdot {0.3333333333333333}^{3}}
\] |
metadata-eval [<=]54.5 | \[ \sqrt[3]{e^{\color{blue}{\left(-2\right)} \cdot \log x} \cdot {0.3333333333333333}^{3}}
\] |
distribute-lft-neg-in [<=]54.5 | \[ \sqrt[3]{e^{\color{blue}{-2 \cdot \log x}} \cdot {0.3333333333333333}^{3}}
\] |
exp-neg [=>]55.7 | \[ \sqrt[3]{\color{blue}{\frac{1}{e^{2 \cdot \log x}}} \cdot {0.3333333333333333}^{3}}
\] |
*-commutative [=>]55.7 | \[ \sqrt[3]{\frac{1}{e^{\color{blue}{\log x \cdot 2}}} \cdot {0.3333333333333333}^{3}}
\] |
exp-to-pow [=>]55.3 | \[ \sqrt[3]{\frac{1}{\color{blue}{{x}^{2}}} \cdot {0.3333333333333333}^{3}}
\] |
unpow2 [=>]55.3 | \[ \sqrt[3]{\frac{1}{\color{blue}{x \cdot x}} \cdot {0.3333333333333333}^{3}}
\] |
associate-*l/ [=>]55.3 | \[ \sqrt[3]{\color{blue}{\frac{1 \cdot {0.3333333333333333}^{3}}{x \cdot x}}}
\] |
metadata-eval [=>]55.3 | \[ \sqrt[3]{\frac{1 \cdot \color{blue}{0.037037037037037035}}{x \cdot x}}
\] |
metadata-eval [=>]55.3 | \[ \sqrt[3]{\frac{\color{blue}{0.037037037037037035}}{x \cdot x}}
\] |
Applied egg-rr1.1
Final simplification0.5
| Alternative 1 | |
|---|---|
| Error | 1.0 |
| Cost | 39684 |
| Alternative 2 | |
|---|---|
| Error | 0.5 |
| Cost | 39168 |
| Alternative 3 | |
|---|---|
| Error | 0.6 |
| Cost | 33024 |
| Alternative 4 | |
|---|---|
| Error | 0.5 |
| Cost | 32896 |
| Alternative 5 | |
|---|---|
| Error | 0.8 |
| Cost | 26308 |
| Alternative 6 | |
|---|---|
| Error | 0.8 |
| Cost | 20360 |
| Alternative 7 | |
|---|---|
| Error | 0.8 |
| Cost | 19720 |
| Alternative 8 | |
|---|---|
| Error | 0.8 |
| Cost | 13640 |
| Alternative 9 | |
|---|---|
| Error | 0.8 |
| Cost | 13448 |
| Alternative 10 | |
|---|---|
| Error | 0.8 |
| Cost | 13384 |
| Alternative 11 | |
|---|---|
| Error | 3.1 |
| Cost | 13321 |
| Alternative 12 | |
|---|---|
| Error | 17.7 |
| Cost | 7113 |
| Alternative 13 | |
|---|---|
| Error | 18.0 |
| Cost | 6985 |
| Alternative 14 | |
|---|---|
| Error | 61.7 |
| Cost | 64 |
| Alternative 15 | |
|---|---|
| Error | 31.6 |
| Cost | 64 |
herbie shell --seed 2023045
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
(- (cbrt (+ x 1.0)) (cbrt x)))