
(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (cbrt x)))
double code(double x) {
return cbrt((x + 1.0)) - cbrt(x);
}
public static double code(double x) {
return Math.cbrt((x + 1.0)) - Math.cbrt(x);
}
function code(x) return Float64(cbrt(Float64(x + 1.0)) - cbrt(x)) end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{x + 1} - \sqrt[3]{x}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (cbrt x)))
double code(double x) {
return cbrt((x + 1.0)) - cbrt(x);
}
public static double code(double x) {
return Math.cbrt((x + 1.0)) - Math.cbrt(x);
}
function code(x) return Float64(cbrt(Float64(x + 1.0)) - cbrt(x)) end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{x + 1} - \sqrt[3]{x}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(if (<= (- t_0 (cbrt x)) 0.0)
(/ 1.0 (fma (cbrt x) (+ (cbrt x) (cbrt x)) (pow t_0 2.0)))
(/ 1.0 (fma (cbrt x) (+ (cbrt x) t_0) (cbrt (pow (+ 1.0 x) 2.0)))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double tmp;
if ((t_0 - cbrt(x)) <= 0.0) {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + cbrt(x)), pow(t_0, 2.0));
} else {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + t_0), cbrt(pow((1.0 + x), 2.0)));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) tmp = 0.0 if (Float64(t_0 - cbrt(x)) <= 0.0) tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(x)), (t_0 ^ 2.0))); else tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), cbrt((Float64(1.0 + x) ^ 2.0)))); end return tmp end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[N[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], 0.0], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision] + N[Power[N[Power[N[(1.0 + x), $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\mathbf{if}\;t_0 - \sqrt[3]{x} \leq 0:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{x}, {t_0}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, \sqrt[3]{{\left(1 + x\right)}^{2}}\right)}\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 0.0Initial program 4.3%
pow1/33.0%
Applied egg-rr3.0%
Applied egg-rr4.3%
associate-*r/4.3%
*-rgt-identity4.3%
+-commutative4.3%
associate--l+98.4%
+-inverses98.4%
metadata-eval98.4%
+-inverses98.4%
sub-neg98.4%
+-commutative98.4%
*-rgt-identity98.4%
fma-udef98.4%
sub-neg98.4%
fma-udef98.4%
*-rgt-identity98.4%
+-commutative98.4%
sub-neg98.4%
+-inverses98.4%
metadata-eval98.4%
+-commutative98.4%
fma-def98.4%
Simplified98.4%
+-commutative98.4%
add-cube-cbrt98.4%
pow398.4%
Applied egg-rr98.4%
Taylor expanded in x around inf 53.8%
unpow1/398.4%
Simplified98.4%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 99.1%
pow1/343.8%
Applied egg-rr43.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-rgt-identity99.8%
+-commutative99.8%
associate--l+99.8%
+-inverses99.8%
metadata-eval99.8%
+-inverses99.8%
sub-neg99.8%
+-commutative99.8%
*-rgt-identity99.8%
fma-udef99.8%
sub-neg99.8%
fma-udef99.8%
*-rgt-identity99.8%
+-commutative99.8%
sub-neg99.8%
+-inverses99.8%
metadata-eval99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
unpow299.8%
cbrt-unprod99.9%
pow299.9%
Applied egg-rr99.9%
Final simplification99.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (pow t_0 2.0)))
(if (<= (- t_0 (cbrt x)) 0.0)
(/ 1.0 (fma (cbrt x) (+ (cbrt x) (cbrt x)) t_1))
(/ (- (+ 1.0 x) x) (+ t_1 (* (cbrt x) (+ (cbrt x) t_0)))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double t_1 = pow(t_0, 2.0);
double tmp;
if ((t_0 - cbrt(x)) <= 0.0) {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + cbrt(x)), t_1);
} else {
tmp = ((1.0 + x) - x) / (t_1 + (cbrt(x) * (cbrt(x) + t_0)));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) t_1 = t_0 ^ 2.0 tmp = 0.0 if (Float64(t_0 - cbrt(x)) <= 0.0) tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(x)), t_1)); else tmp = Float64(Float64(Float64(1.0 + x) - x) / Float64(t_1 + Float64(cbrt(x) * Float64(cbrt(x) + t_0)))); end return tmp end
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]}, If[LessEqual[N[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], 0.0], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + x), $MachinePrecision] - x), $MachinePrecision] / N[(t$95$1 + N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
t_1 := {t_0}^{2}\\
\mathbf{if}\;t_0 - \sqrt[3]{x} \leq 0:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{x}, t_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + x\right) - x}{t_1 + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + t_0\right)}\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 0.0Initial program 4.3%
pow1/33.0%
Applied egg-rr3.0%
Applied egg-rr4.3%
associate-*r/4.3%
*-rgt-identity4.3%
+-commutative4.3%
associate--l+98.4%
+-inverses98.4%
metadata-eval98.4%
+-inverses98.4%
sub-neg98.4%
+-commutative98.4%
*-rgt-identity98.4%
fma-udef98.4%
sub-neg98.4%
fma-udef98.4%
*-rgt-identity98.4%
+-commutative98.4%
sub-neg98.4%
+-inverses98.4%
metadata-eval98.4%
+-commutative98.4%
fma-def98.4%
Simplified98.4%
+-commutative98.4%
add-cube-cbrt98.4%
pow398.4%
Applied egg-rr98.4%
Taylor expanded in x around inf 53.8%
unpow1/398.4%
Simplified98.4%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 99.1%
pow1/343.8%
Applied egg-rr43.8%
pow1/399.1%
flip3--99.0%
rem-cube-cbrt99.4%
rem-cube-cbrt99.8%
pow299.8%
distribute-rgt-out99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification99.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (- t_0 (cbrt x))))
(if (<= t_1 0.0)
(/ 1.0 (fma (cbrt x) (+ 1.0 (cbrt x)) (pow t_0 2.0)))
(pow (pow t_1 3.0) 0.3333333333333333))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double t_1 = t_0 - cbrt(x);
double tmp;
if (t_1 <= 0.0) {
tmp = 1.0 / fma(cbrt(x), (1.0 + cbrt(x)), pow(t_0, 2.0));
} else {
tmp = pow(pow(t_1, 3.0), 0.3333333333333333);
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) t_1 = Float64(t_0 - cbrt(x)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(1.0 / fma(cbrt(x), Float64(1.0 + cbrt(x)), (t_0 ^ 2.0))); else tmp = (t_1 ^ 3.0) ^ 0.3333333333333333; end return tmp end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(1.0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[Power[t$95$1, 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
t_1 := t_0 - \sqrt[3]{x}\\
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, 1 + \sqrt[3]{x}, {t_0}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left({t_1}^{3}\right)}^{0.3333333333333333}\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 0.0Initial program 4.3%
pow1/33.0%
Applied egg-rr3.0%
Applied egg-rr4.3%
associate-*r/4.3%
*-rgt-identity4.3%
+-commutative4.3%
associate--l+98.4%
+-inverses98.4%
metadata-eval98.4%
+-inverses98.4%
sub-neg98.4%
+-commutative98.4%
*-rgt-identity98.4%
fma-udef98.4%
sub-neg98.4%
fma-udef98.4%
*-rgt-identity98.4%
+-commutative98.4%
sub-neg98.4%
+-inverses98.4%
metadata-eval98.4%
+-commutative98.4%
fma-def98.4%
Simplified98.4%
+-commutative98.4%
add-cube-cbrt98.4%
pow398.4%
Applied egg-rr98.4%
Taylor expanded in x around 0 20.0%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 99.1%
add-cbrt-cube99.0%
pow1/399.1%
pow399.1%
Applied egg-rr99.1%
Final simplification62.3%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (- t_0 (cbrt x))))
(if (<= t_1 0.0)
(/ 1.0 (fma (cbrt x) (+ (cbrt x) t_0) 1.0))
(pow (pow t_1 3.0) 0.3333333333333333))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double t_1 = t_0 - cbrt(x);
double tmp;
if (t_1 <= 0.0) {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + t_0), 1.0);
} else {
tmp = pow(pow(t_1, 3.0), 0.3333333333333333);
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) t_1 = Float64(t_0 - cbrt(x)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), 1.0)); else tmp = (t_1 ^ 3.0) ^ 0.3333333333333333; end return tmp end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[Power[N[Power[t$95$1, 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
t_1 := t_0 - \sqrt[3]{x}\\
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left({t_1}^{3}\right)}^{0.3333333333333333}\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 0.0Initial program 4.3%
flip3--4.3%
div-inv4.3%
rem-cube-cbrt3.6%
rem-cube-cbrt4.3%
+-commutative4.3%
distribute-rgt-out4.3%
+-commutative4.3%
fma-def4.3%
add-exp-log4.3%
Applied egg-rr2.4%
associate-*r/2.4%
*-rgt-identity2.4%
+-commutative2.4%
associate--l+53.0%
+-inverses53.0%
metadata-eval53.0%
+-commutative53.0%
exp-prod52.3%
Simplified52.3%
Taylor expanded in x around 0 20.0%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 99.1%
add-cbrt-cube99.0%
pow1/399.1%
pow399.1%
Applied egg-rr99.1%
Final simplification62.3%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x)))) (/ 1.0 (fma (cbrt x) (+ (cbrt x) t_0) (pow t_0 2.0)))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / fma(cbrt(x), (cbrt(x) + t_0), pow(t_0, 2.0));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), (t_0 ^ 2.0))) end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, N[(1.0 / 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]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, {t_0}^{2}\right)}
\end{array}
\end{array}
Initial program 55.0%
pow1/324.8%
Applied egg-rr24.8%
Applied egg-rr55.4%
associate-*r/55.4%
*-rgt-identity55.4%
+-commutative55.4%
associate--l+99.2%
+-inverses99.2%
metadata-eval99.2%
+-inverses99.2%
sub-neg99.2%
+-commutative99.2%
*-rgt-identity99.2%
fma-udef99.2%
sub-neg99.2%
fma-udef99.2%
*-rgt-identity99.2%
+-commutative99.2%
sub-neg99.2%
+-inverses99.2%
metadata-eval99.2%
+-commutative99.2%
fma-def99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ (cbrt x) (cbrt (+ 1.0 x)))))
(if (<= x -1.0)
(/ 1.0 (fma (cbrt x) t_0 1.0))
(/ 1.0 (+ (* (cbrt x) t_0) (exp (* (log1p x) 0.6666666666666666)))))))
double code(double x) {
double t_0 = cbrt(x) + cbrt((1.0 + x));
double tmp;
if (x <= -1.0) {
tmp = 1.0 / fma(cbrt(x), t_0, 1.0);
} else {
tmp = 1.0 / ((cbrt(x) * t_0) + exp((log1p(x) * 0.6666666666666666)));
}
return tmp;
}
function code(x) t_0 = Float64(cbrt(x) + cbrt(Float64(1.0 + x))) tmp = 0.0 if (x <= -1.0) tmp = Float64(1.0 / fma(cbrt(x), t_0, 1.0)); else tmp = Float64(1.0 / Float64(Float64(cbrt(x) * t_0) + exp(Float64(log1p(x) * 0.6666666666666666)))); end return tmp end
code[x_] := Block[{t$95$0 = N[(N[Power[x, 1/3], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.0], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0), $MachinePrecision] + N[Exp[N[(N[Log[1 + x], $MachinePrecision] * 0.6666666666666666), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{x} + \sqrt[3]{1 + x}\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_0, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt[3]{x} \cdot t_0 + e^{\mathsf{log1p}\left(x\right) \cdot 0.6666666666666666}}\\
\end{array}
\end{array}
if x < -1Initial program 9.1%
flip3--9.1%
div-inv9.1%
rem-cube-cbrt10.0%
rem-cube-cbrt11.2%
+-commutative11.2%
distribute-rgt-out11.2%
+-commutative11.2%
fma-def11.2%
add-exp-log11.2%
Applied egg-rr0.0%
associate-*r/0.0%
*-rgt-identity0.0%
+-commutative0.0%
associate--l+0.0%
+-inverses0.0%
metadata-eval0.0%
+-commutative0.0%
exp-prod0.0%
Simplified0.0%
Taylor expanded in x around 0 20.0%
if -1 < x Initial program 67.6%
pow1/331.6%
Applied egg-rr31.6%
Applied egg-rr67.5%
associate-*r/67.5%
*-rgt-identity67.5%
+-commutative67.5%
associate--l+99.4%
+-inverses99.4%
metadata-eval99.4%
+-inverses99.4%
sub-neg99.4%
+-commutative99.4%
*-rgt-identity99.4%
fma-udef99.4%
sub-neg99.4%
fma-udef99.4%
*-rgt-identity99.4%
+-commutative99.4%
sub-neg99.4%
+-inverses99.4%
metadata-eval99.4%
+-commutative99.4%
fma-def99.4%
Simplified99.4%
fma-udef99.4%
pow1/397.4%
pow-to-exp97.5%
log1p-udef97.5%
pow-exp97.5%
associate-*l*97.5%
metadata-eval97.5%
Applied egg-rr97.5%
Final simplification80.8%
(FPCore (x) :precision binary64 (pow (pow (- (cbrt (+ 1.0 x)) (cbrt x)) 3.0) 0.3333333333333333))
double code(double x) {
return pow(pow((cbrt((1.0 + x)) - cbrt(x)), 3.0), 0.3333333333333333);
}
public static double code(double x) {
return Math.pow(Math.pow((Math.cbrt((1.0 + x)) - Math.cbrt(x)), 3.0), 0.3333333333333333);
}
function code(x) return (Float64(cbrt(Float64(1.0 + x)) - cbrt(x)) ^ 3.0) ^ 0.3333333333333333 end
code[x_] := N[Power[N[Power[N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]
\begin{array}{l}
\\
{\left({\left(\sqrt[3]{1 + x} - \sqrt[3]{x}\right)}^{3}\right)}^{0.3333333333333333}
\end{array}
Initial program 55.0%
add-cbrt-cube55.0%
pow1/355.0%
pow355.0%
Applied egg-rr55.0%
Final simplification55.0%
(FPCore (x) :precision binary64 (- (cbrt (+ 1.0 x)) (cbrt x)))
double code(double x) {
return cbrt((1.0 + x)) - cbrt(x);
}
public static double code(double x) {
return Math.cbrt((1.0 + x)) - Math.cbrt(x);
}
function code(x) return Float64(cbrt(Float64(1.0 + x)) - cbrt(x)) end
code[x_] := N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{1 + x} - \sqrt[3]{x}
\end{array}
Initial program 55.0%
Final simplification55.0%
(FPCore (x) :precision binary64 (- (+ 1.0 (* x 0.3333333333333333)) (cbrt x)))
double code(double x) {
return (1.0 + (x * 0.3333333333333333)) - cbrt(x);
}
public static double code(double x) {
return (1.0 + (x * 0.3333333333333333)) - Math.cbrt(x);
}
function code(x) return Float64(Float64(1.0 + Float64(x * 0.3333333333333333)) - cbrt(x)) end
code[x_] := N[(N[(1.0 + N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + x \cdot 0.3333333333333333\right) - \sqrt[3]{x}
\end{array}
Initial program 55.0%
add-cube-cbrt54.8%
pow354.8%
Applied egg-rr54.8%
Taylor expanded in x around 0 24.0%
*-commutative24.0%
metadata-eval24.0%
pow-base-124.0%
unpow1/352.7%
*-lft-identity52.7%
Simplified52.7%
Final simplification52.7%
(FPCore (x) :precision binary64 (- 1.0 (cbrt x)))
double code(double x) {
return 1.0 - cbrt(x);
}
public static double code(double x) {
return 1.0 - Math.cbrt(x);
}
function code(x) return Float64(1.0 - cbrt(x)) end
code[x_] := N[(1.0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \sqrt[3]{x}
\end{array}
Initial program 55.0%
add-cube-cbrt54.8%
pow354.8%
Applied egg-rr54.8%
Taylor expanded in x around 0 23.3%
metadata-eval23.3%
pow-base-123.3%
unpow1/352.5%
*-lft-identity52.5%
Simplified52.5%
Final simplification52.5%
(FPCore (x) :precision binary64 0.0)
double code(double x) {
return 0.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 0.0d0
end function
public static double code(double x) {
return 0.0;
}
def code(x): return 0.0
function code(x) return 0.0 end
function tmp = code(x) tmp = 0.0; end
code[x_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 55.0%
Taylor expanded in x around inf 3.7%
Final simplification3.7%
(FPCore (x) :precision binary64 1.0)
double code(double x) {
return 1.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0
end function
public static double code(double x) {
return 1.0;
}
def code(x): return 1.0
function code(x) return 1.0 end
function tmp = code(x) tmp = 1.0; end
code[x_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 55.0%
Taylor expanded in x around 0 51.0%
Final simplification51.0%
herbie shell --seed 2023310
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
(- (cbrt (+ x 1.0)) (cbrt x)))