
(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 11 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)))) (/ 1.0 (+ (* (cbrt x) (+ (cbrt x) t_0)) (/ 1.0 (pow t_0 -2.0))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / ((cbrt(x) * (cbrt(x) + t_0)) + (1.0 / pow(t_0, -2.0)));
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
return 1.0 / ((Math.cbrt(x) * (Math.cbrt(x) + t_0)) + (1.0 / Math.pow(t_0, -2.0)));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / Float64(Float64(cbrt(x) * Float64(cbrt(x) + t_0)) + Float64(1.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[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Power[t$95$0, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + t_0\right) + \frac{1}{{t_0}^{-2}}}
\end{array}
\end{array}
Initial program 48.9%
flip3--48.9%
div-inv48.9%
rem-cube-cbrt48.6%
rem-cube-cbrt49.4%
cbrt-unprod49.4%
pow249.4%
distribute-rgt-out49.4%
+-commutative49.4%
Applied egg-rr49.4%
associate-*r/49.4%
*-rgt-identity49.4%
+-commutative49.4%
associate--l+72.8%
+-inverses72.8%
metadata-eval72.8%
+-commutative72.8%
fma-def72.8%
+-commutative72.8%
+-commutative72.8%
Simplified72.8%
Applied egg-rr99.1%
fma-udef99.1%
div-inv99.0%
pow1/369.5%
remove-double-div69.5%
pow1/369.2%
pow-prod-up69.2%
metadata-eval69.2%
add-exp-log69.2%
log-pow69.1%
log1p-udef69.1%
Applied egg-rr69.1%
*-commutative69.1%
log1p-udef69.1%
exp-to-pow69.2%
metadata-eval69.2%
metadata-eval69.2%
pow-pow69.2%
pow1/399.0%
metadata-eval99.0%
metadata-eval99.0%
pow-flip99.1%
Applied egg-rr99.1%
Final simplification99.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (- t_0 (cbrt x))))
(if (<= t_1 1.5e-6)
(/ 1.0 (+ (* (cbrt x) (+ (cbrt x) t_0)) (cbrt (* x x))))
(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 <= 1.5e-6) {
tmp = 1.0 / ((cbrt(x) * (cbrt(x) + t_0)) + cbrt((x * x)));
} else {
tmp = pow(pow(t_1, 3.0), 0.3333333333333333);
}
return tmp;
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
double t_1 = t_0 - Math.cbrt(x);
double tmp;
if (t_1 <= 1.5e-6) {
tmp = 1.0 / ((Math.cbrt(x) * (Math.cbrt(x) + t_0)) + Math.cbrt((x * x)));
} else {
tmp = Math.pow(Math.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 <= 1.5e-6) tmp = Float64(1.0 / Float64(Float64(cbrt(x) * Float64(cbrt(x) + t_0)) + cbrt(Float64(x * x)))); 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, 1.5e-6], N[(1.0 / N[(N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision] + N[Power[N[(x * x), $MachinePrecision], 1/3], $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 1.5 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + t_0\right) + \sqrt[3]{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;{\left({t_1}^{3}\right)}^{0.3333333333333333}\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 1.5e-6Initial program 4.7%
flip3--4.7%
div-inv4.7%
rem-cube-cbrt4.5%
rem-cube-cbrt5.6%
cbrt-unprod5.6%
pow25.6%
distribute-rgt-out5.6%
+-commutative5.6%
Applied egg-rr5.6%
associate-*r/5.6%
*-rgt-identity5.6%
+-commutative5.6%
associate--l+49.4%
+-inverses49.4%
metadata-eval49.4%
+-commutative49.4%
fma-def49.3%
+-commutative49.3%
+-commutative49.3%
Simplified49.3%
Applied egg-rr98.4%
fma-udef98.4%
div-inv98.3%
pow1/343.9%
remove-double-div43.9%
pow1/343.2%
pow-prod-up43.2%
metadata-eval43.2%
add-exp-log43.3%
log-pow43.2%
log1p-udef43.2%
Applied egg-rr43.2%
Taylor expanded in x around inf 46.8%
unpow1/349.1%
unpow249.1%
Simplified49.1%
if 1.5e-6 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 99.7%
add-cbrt-cube99.6%
pow1/399.7%
pow399.7%
Applied egg-rr99.7%
Final simplification72.6%
(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.2%
flip3--4.2%
div-inv4.2%
rem-cube-cbrt4.0%
rem-cube-cbrt4.2%
cbrt-unprod4.2%
pow24.2%
distribute-rgt-out4.2%
+-commutative4.2%
Applied egg-rr4.2%
associate-*r/4.2%
*-rgt-identity4.2%
+-commutative4.2%
associate--l+48.6%
+-inverses48.6%
metadata-eval48.6%
+-commutative48.6%
fma-def48.6%
+-commutative48.6%
+-commutative48.6%
Simplified48.6%
Taylor expanded in x around 0 20.0%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 98.7%
add-cbrt-cube98.6%
pow1/398.7%
pow398.7%
Applied egg-rr98.7%
Final simplification57.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ (cbrt x) (cbrt (+ 1.0 x)))))
(if (<= x -1.35e+154)
(/ 1.0 (fma (cbrt x) t_0 1.0))
(if (<= x -1.0)
(/ 1.0 (fma (cbrt x) t_0 (cbrt (* x x))))
(/ 1.0 (fma (cbrt x) t_0 (pow (+ 1.0 x) 0.6666666666666666)))))))
double code(double x) {
double t_0 = cbrt(x) + cbrt((1.0 + x));
double tmp;
if (x <= -1.35e+154) {
tmp = 1.0 / fma(cbrt(x), t_0, 1.0);
} else if (x <= -1.0) {
tmp = 1.0 / fma(cbrt(x), t_0, cbrt((x * x)));
} else {
tmp = 1.0 / fma(cbrt(x), t_0, pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
function code(x) t_0 = Float64(cbrt(x) + cbrt(Float64(1.0 + x))) tmp = 0.0 if (x <= -1.35e+154) tmp = Float64(1.0 / fma(cbrt(x), t_0, 1.0)); elseif (x <= -1.0) tmp = Float64(1.0 / fma(cbrt(x), t_0, cbrt(Float64(x * x)))); else tmp = Float64(1.0 / fma(cbrt(x), t_0, (Float64(1.0 + 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.35e+154], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.0], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0 + N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0 + N[Power[N[(1.0 + x), $MachinePrecision], 0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{x} + \sqrt[3]{1 + x}\\
\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(1 + x\right)}^{0.6666666666666666}\right)}\\
\end{array}
\end{array}
if x < -1.35000000000000003e154Initial program 4.6%
flip3--4.6%
div-inv4.6%
rem-cube-cbrt3.8%
rem-cube-cbrt4.6%
cbrt-unprod4.6%
pow24.6%
distribute-rgt-out4.6%
+-commutative4.6%
Applied egg-rr4.6%
associate-*r/4.6%
*-rgt-identity4.6%
+-commutative4.6%
associate--l+4.6%
+-inverses4.6%
metadata-eval4.6%
+-commutative4.6%
fma-def4.6%
+-commutative4.6%
+-commutative4.6%
Simplified4.6%
Taylor expanded in x around 0 20.0%
if -1.35000000000000003e154 < x < -1Initial program 7.7%
flip3--8.5%
div-inv8.5%
rem-cube-cbrt9.0%
rem-cube-cbrt11.9%
cbrt-unprod11.9%
pow211.9%
distribute-rgt-out11.9%
+-commutative11.9%
Applied egg-rr11.9%
associate-*r/11.9%
*-rgt-identity11.9%
+-commutative11.9%
associate--l+98.6%
+-inverses98.6%
metadata-eval98.6%
+-commutative98.6%
fma-def98.6%
+-commutative98.6%
+-commutative98.6%
Simplified98.6%
pow1/394.5%
pow-pow0.0%
metadata-eval0.0%
Applied egg-rr0.0%
Taylor expanded in x around inf 92.3%
unpow1/396.4%
unpow296.4%
Simplified96.4%
if -1 < x Initial program 66.3%
flip3--66.2%
div-inv66.2%
rem-cube-cbrt65.9%
rem-cube-cbrt66.2%
cbrt-unprod66.3%
pow266.3%
distribute-rgt-out66.2%
+-commutative66.2%
Applied egg-rr66.2%
associate-*r/66.2%
*-rgt-identity66.2%
+-commutative66.2%
associate--l+83.0%
+-inverses83.0%
metadata-eval83.0%
+-commutative83.0%
fma-def83.0%
+-commutative83.0%
+-commutative83.0%
Simplified83.0%
pow1/382.1%
pow-pow97.3%
metadata-eval97.3%
Applied egg-rr97.3%
Final simplification85.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ (cbrt x) (cbrt (+ 1.0 x)))))
(if (<= x -1.35e+154)
(/ 1.0 (fma (cbrt x) t_0 1.0))
(if (<= x -1.0)
(/ 1.0 (fma (cbrt x) t_0 (cbrt (* x x))))
(/ 1.0 (+ (* (cbrt x) t_0) (pow (+ 1.0 x) 0.6666666666666666)))))))
double code(double x) {
double t_0 = cbrt(x) + cbrt((1.0 + x));
double tmp;
if (x <= -1.35e+154) {
tmp = 1.0 / fma(cbrt(x), t_0, 1.0);
} else if (x <= -1.0) {
tmp = 1.0 / fma(cbrt(x), t_0, cbrt((x * x)));
} else {
tmp = 1.0 / ((cbrt(x) * t_0) + pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
function code(x) t_0 = Float64(cbrt(x) + cbrt(Float64(1.0 + x))) tmp = 0.0 if (x <= -1.35e+154) tmp = Float64(1.0 / fma(cbrt(x), t_0, 1.0)); elseif (x <= -1.0) tmp = Float64(1.0 / fma(cbrt(x), t_0, cbrt(Float64(x * x)))); else tmp = Float64(1.0 / Float64(Float64(cbrt(x) * t_0) + (Float64(1.0 + 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.35e+154], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.0], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0 + N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0), $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{x} + \sqrt[3]{1 + x}\\
\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}{\sqrt[3]{x} \cdot t_0 + {\left(1 + x\right)}^{0.6666666666666666}}\\
\end{array}
\end{array}
if x < -1.35000000000000003e154Initial program 4.6%
flip3--4.6%
div-inv4.6%
rem-cube-cbrt3.8%
rem-cube-cbrt4.6%
cbrt-unprod4.6%
pow24.6%
distribute-rgt-out4.6%
+-commutative4.6%
Applied egg-rr4.6%
associate-*r/4.6%
*-rgt-identity4.6%
+-commutative4.6%
associate--l+4.6%
+-inverses4.6%
metadata-eval4.6%
+-commutative4.6%
fma-def4.6%
+-commutative4.6%
+-commutative4.6%
Simplified4.6%
Taylor expanded in x around 0 20.0%
if -1.35000000000000003e154 < x < -1Initial program 7.7%
flip3--8.5%
div-inv8.5%
rem-cube-cbrt9.0%
rem-cube-cbrt11.9%
cbrt-unprod11.9%
pow211.9%
distribute-rgt-out11.9%
+-commutative11.9%
Applied egg-rr11.9%
associate-*r/11.9%
*-rgt-identity11.9%
+-commutative11.9%
associate--l+98.6%
+-inverses98.6%
metadata-eval98.6%
+-commutative98.6%
fma-def98.6%
+-commutative98.6%
+-commutative98.6%
Simplified98.6%
pow1/394.5%
pow-pow0.0%
metadata-eval0.0%
Applied egg-rr0.0%
Taylor expanded in x around inf 92.3%
unpow1/396.4%
unpow296.4%
Simplified96.4%
if -1 < x Initial program 66.3%
flip3--66.2%
div-inv66.2%
rem-cube-cbrt65.9%
rem-cube-cbrt66.2%
cbrt-unprod66.3%
pow266.3%
distribute-rgt-out66.2%
+-commutative66.2%
Applied egg-rr66.2%
associate-*r/66.2%
*-rgt-identity66.2%
+-commutative66.2%
associate--l+83.0%
+-inverses83.0%
metadata-eval83.0%
+-commutative83.0%
fma-def83.0%
+-commutative83.0%
+-commutative83.0%
Simplified83.0%
Applied egg-rr99.3%
fma-udef99.4%
div-inv99.3%
pow1/397.8%
remove-double-div97.8%
pow1/397.3%
pow-prod-up97.3%
metadata-eval97.3%
add-exp-log97.3%
log-pow97.3%
log1p-udef97.3%
Applied egg-rr97.3%
*-commutative97.3%
log1p-udef97.3%
exp-to-pow97.3%
Applied egg-rr97.3%
Final simplification85.1%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x)))) (/ 1.0 (+ (* (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 / ((cbrt(x) * (cbrt(x) + t_0)) + pow(t_0, 2.0));
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
return 1.0 / ((Math.cbrt(x) * (Math.cbrt(x) + t_0)) + Math.pow(t_0, 2.0));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / Float64(Float64(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[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision]), $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}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + t_0\right) + {t_0}^{2}}
\end{array}
\end{array}
Initial program 48.9%
flip3--48.9%
div-inv48.9%
rem-cube-cbrt48.6%
rem-cube-cbrt49.4%
cbrt-unprod49.4%
pow249.4%
distribute-rgt-out49.4%
+-commutative49.4%
Applied egg-rr49.4%
associate-*r/49.4%
*-rgt-identity49.4%
+-commutative49.4%
associate--l+72.8%
+-inverses72.8%
metadata-eval72.8%
+-commutative72.8%
fma-def72.8%
+-commutative72.8%
+-commutative72.8%
Simplified72.8%
add-cbrt-cube72.8%
pow372.8%
+-commutative72.8%
pow1/371.6%
unpow271.6%
pow-prod-down58.3%
+-commutative58.3%
pow1/358.5%
+-commutative58.5%
pow1/372.7%
pow272.7%
+-commutative72.7%
Applied egg-rr72.7%
rem-cbrt-cube99.0%
fma-udef99.0%
+-commutative99.0%
+-commutative99.0%
+-commutative99.0%
distribute-rgt-in99.0%
unpow299.0%
+-commutative99.0%
fma-def99.0%
Applied egg-rr99.0%
fma-udef99.0%
unpow299.0%
Simplified99.0%
Final simplification99.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ (cbrt x) (cbrt (+ 1.0 x)))) (t_1 (* (cbrt x) t_0)))
(if (<= x -1.35e+154)
(/ 1.0 (fma (cbrt x) t_0 1.0))
(if (<= x -1.0)
(/ 1.0 (+ t_1 (cbrt (* x x))))
(/ 1.0 (+ t_1 (pow (+ 1.0 x) 0.6666666666666666)))))))
double code(double x) {
double t_0 = cbrt(x) + cbrt((1.0 + x));
double t_1 = cbrt(x) * t_0;
double tmp;
if (x <= -1.35e+154) {
tmp = 1.0 / fma(cbrt(x), t_0, 1.0);
} else if (x <= -1.0) {
tmp = 1.0 / (t_1 + cbrt((x * x)));
} else {
tmp = 1.0 / (t_1 + pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
function code(x) t_0 = Float64(cbrt(x) + cbrt(Float64(1.0 + x))) t_1 = Float64(cbrt(x) * t_0) tmp = 0.0 if (x <= -1.35e+154) tmp = Float64(1.0 / fma(cbrt(x), t_0, 1.0)); elseif (x <= -1.0) tmp = Float64(1.0 / Float64(t_1 + cbrt(Float64(x * x)))); else tmp = Float64(1.0 / Float64(t_1 + (Float64(1.0 + 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]}, Block[{t$95$1 = N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[x, -1.35e+154], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.0], N[(1.0 / N[(t$95$1 + N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[Power[N[(1.0 + x), $MachinePrecision], 0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{x} + \sqrt[3]{1 + x}\\
t_1 := \sqrt[3]{x} \cdot t_0\\
\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}{t_1 + \sqrt[3]{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_1 + {\left(1 + x\right)}^{0.6666666666666666}}\\
\end{array}
\end{array}
if x < -1.35000000000000003e154Initial program 4.6%
flip3--4.6%
div-inv4.6%
rem-cube-cbrt3.8%
rem-cube-cbrt4.6%
cbrt-unprod4.6%
pow24.6%
distribute-rgt-out4.6%
+-commutative4.6%
Applied egg-rr4.6%
associate-*r/4.6%
*-rgt-identity4.6%
+-commutative4.6%
associate--l+4.6%
+-inverses4.6%
metadata-eval4.6%
+-commutative4.6%
fma-def4.6%
+-commutative4.6%
+-commutative4.6%
Simplified4.6%
Taylor expanded in x around 0 20.0%
if -1.35000000000000003e154 < x < -1Initial program 7.7%
flip3--8.5%
div-inv8.5%
rem-cube-cbrt9.0%
rem-cube-cbrt11.9%
cbrt-unprod11.9%
pow211.9%
distribute-rgt-out11.9%
+-commutative11.9%
Applied egg-rr11.9%
associate-*r/11.9%
*-rgt-identity11.9%
+-commutative11.9%
associate--l+98.6%
+-inverses98.6%
metadata-eval98.6%
+-commutative98.6%
fma-def98.6%
+-commutative98.6%
+-commutative98.6%
Simplified98.6%
Applied egg-rr98.4%
fma-udef98.3%
div-inv98.3%
pow1/30.0%
remove-double-div0.0%
pow1/30.0%
pow-prod-up0.0%
metadata-eval0.0%
add-exp-log0.0%
log-pow0.0%
log1p-udef0.0%
Applied egg-rr0.0%
Taylor expanded in x around inf 92.4%
unpow1/396.4%
unpow296.4%
Simplified96.4%
if -1 < x Initial program 66.3%
flip3--66.2%
div-inv66.2%
rem-cube-cbrt65.9%
rem-cube-cbrt66.2%
cbrt-unprod66.3%
pow266.3%
distribute-rgt-out66.2%
+-commutative66.2%
Applied egg-rr66.2%
associate-*r/66.2%
*-rgt-identity66.2%
+-commutative66.2%
associate--l+83.0%
+-inverses83.0%
metadata-eval83.0%
+-commutative83.0%
fma-def83.0%
+-commutative83.0%
+-commutative83.0%
Simplified83.0%
Applied egg-rr99.3%
fma-udef99.4%
div-inv99.3%
pow1/397.8%
remove-double-div97.8%
pow1/397.3%
pow-prod-up97.3%
metadata-eval97.3%
add-exp-log97.3%
log-pow97.3%
log1p-udef97.3%
Applied egg-rr97.3%
*-commutative97.3%
log1p-udef97.3%
exp-to-pow97.3%
Applied egg-rr97.3%
Final simplification85.1%
(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 48.9%
add-cbrt-cube48.8%
pow1/348.9%
pow348.9%
Applied egg-rr48.9%
Final simplification48.9%
(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 48.9%
Final simplification48.9%
(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 48.9%
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 48.9%
Taylor expanded in x around 0 46.6%
Final simplification46.6%
herbie shell --seed 2023252
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
(- (cbrt (+ x 1.0)) (cbrt x)))