
(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 13 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 (fma (cbrt x) (+ (cbrt x) t_0) (* t_0 (/ -1.0 (/ -1.0 t_0)))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / fma(cbrt(x), (cbrt(x) + t_0), (t_0 * (-1.0 / (-1.0 / t_0))));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), Float64(t_0 * Float64(-1.0 / Float64(-1.0 / t_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[(t$95$0 * N[(-1.0 / N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $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 \cdot \frac{-1}{\frac{-1}{t_0}}\right)}
\end{array}
\end{array}
Initial program 56.2%
flip3--56.2%
div-inv56.2%
rem-cube-cbrt55.9%
rem-cube-cbrt57.2%
cbrt-unprod57.2%
pow257.2%
distribute-rgt-out57.2%
+-commutative57.2%
Applied egg-rr57.2%
associate-*r/57.2%
*-rgt-identity57.2%
+-commutative57.2%
associate--l+78.1%
+-inverses78.1%
metadata-eval78.1%
+-commutative78.1%
fma-def78.1%
+-commutative78.1%
+-commutative78.1%
Simplified78.1%
unpow278.1%
+-commutative78.1%
add-cube-cbrt78.0%
+-commutative78.0%
add-cube-cbrt78.0%
swap-sqr78.0%
add-cbrt-cube99.2%
pow299.2%
metadata-eval99.2%
sub-neg99.2%
flip--78.0%
metadata-eval78.0%
fma-neg78.0%
metadata-eval78.0%
cbrt-undiv78.1%
pow278.1%
clear-num78.1%
Applied egg-rr99.2%
frac-2neg99.2%
div-inv99.2%
distribute-neg-frac99.2%
metadata-eval99.2%
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (- t_0 (cbrt x))))
(if (<= t_1 1e-6)
(/ 1.0 (fma (cbrt x) (+ (cbrt x) t_0) (cbrt (* x x))))
t_1)))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double t_1 = t_0 - cbrt(x);
double tmp;
if (t_1 <= 1e-6) {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + t_0), cbrt((x * x)));
} else {
tmp = t_1;
}
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 <= 1e-6) tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), cbrt(Float64(x * x)))); else tmp = t_1; 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, 1e-6], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision] + N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
t_1 := t_0 - \sqrt[3]{x}\\
\mathbf{if}\;t_1 \leq 10^{-6}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, \sqrt[3]{x \cdot x}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 9.99999999999999955e-7Initial program 5.3%
flip3--5.3%
div-inv5.3%
rem-cube-cbrt4.7%
rem-cube-cbrt7.4%
cbrt-unprod7.4%
pow27.4%
distribute-rgt-out7.4%
+-commutative7.4%
Applied egg-rr7.4%
associate-*r/7.4%
*-rgt-identity7.4%
+-commutative7.4%
associate--l+52.6%
+-inverses52.6%
metadata-eval52.6%
+-commutative52.6%
fma-def52.6%
+-commutative52.6%
+-commutative52.6%
Simplified52.6%
add-exp-log50.9%
pow1/350.5%
log-pow50.5%
log-pow57.0%
log1p-udef57.0%
Applied egg-rr57.0%
associate-*r*57.0%
metadata-eval57.0%
Simplified57.0%
Taylor expanded in x around inf 49.6%
unpow1/352.0%
unpow252.0%
Simplified52.0%
if 9.99999999999999955e-7 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 99.7%
Final simplification77.7%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x)))) (/ 1.0 (fma (cbrt x) (+ (cbrt x) t_0) (/ t_0 (/ 1.0 t_0))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / fma(cbrt(x), (cbrt(x) + t_0), (t_0 / (1.0 / t_0)));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), Float64(t_0 / Float64(1.0 / t_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[(t$95$0 / N[(1.0 / t$95$0), $MachinePrecision]), $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, \frac{t_0}{\frac{1}{t_0}}\right)}
\end{array}
\end{array}
Initial program 56.2%
flip3--56.2%
div-inv56.2%
rem-cube-cbrt55.9%
rem-cube-cbrt57.2%
cbrt-unprod57.2%
pow257.2%
distribute-rgt-out57.2%
+-commutative57.2%
Applied egg-rr57.2%
associate-*r/57.2%
*-rgt-identity57.2%
+-commutative57.2%
associate--l+78.1%
+-inverses78.1%
metadata-eval78.1%
+-commutative78.1%
fma-def78.1%
+-commutative78.1%
+-commutative78.1%
Simplified78.1%
unpow278.1%
+-commutative78.1%
add-cube-cbrt78.0%
+-commutative78.0%
add-cube-cbrt78.0%
swap-sqr78.0%
add-cbrt-cube99.2%
pow299.2%
metadata-eval99.2%
sub-neg99.2%
flip--78.0%
metadata-eval78.0%
fma-neg78.0%
metadata-eval78.0%
cbrt-undiv78.1%
pow278.1%
clear-num78.1%
Applied egg-rr99.2%
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) (+ (cbrt x) t_0) 1.0)) t_1)))
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 = t_1;
}
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; 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], t$95$1]]]
\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}:\\
\;\;\;\;t_1\\
\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-cbrt3.6%
rem-cube-cbrt5.0%
cbrt-unprod5.0%
pow25.0%
distribute-rgt-out5.0%
+-commutative5.0%
Applied egg-rr5.0%
associate-*r/5.0%
*-rgt-identity5.0%
+-commutative5.0%
associate--l+51.4%
+-inverses51.4%
metadata-eval51.4%
+-commutative51.4%
fma-def51.4%
+-commutative51.4%
+-commutative51.4%
Simplified51.4%
Taylor expanded in x around 0 20.0%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 98.6%
Final simplification63.3%
(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 (cbrt (pow (+ 1.0 x) 2.0))))
(/ 1.0 (fma (cbrt x) t_0 (exp (* 0.6666666666666666 (log1p x))))))))
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, cbrt(pow((1.0 + x), 2.0)));
} else {
tmp = 1.0 / fma(cbrt(x), t_0, exp((0.6666666666666666 * log1p(x))));
}
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, cbrt((Float64(1.0 + x) ^ 2.0)))); else tmp = Float64(1.0 / fma(cbrt(x), t_0, exp(Float64(0.6666666666666666 * log1p(x))))); 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 + N[Power[N[Power[N[(1.0 + x), $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0 + N[Exp[N[(0.6666666666666666 * N[Log[1 + x], $MachinePrecision]), $MachinePrecision]], $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, \sqrt[3]{{\left(1 + x\right)}^{2}}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_0, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 64.6%
flip3--64.6%
div-inv64.5%
rem-cube-cbrt64.5%
rem-cube-cbrt65.8%
cbrt-unprod65.8%
pow265.8%
distribute-rgt-out65.8%
+-commutative65.8%
Applied egg-rr65.8%
associate-*r/65.8%
*-rgt-identity65.8%
+-commutative65.8%
associate--l+90.1%
+-inverses90.1%
metadata-eval90.1%
+-commutative90.1%
fma-def90.0%
+-commutative90.0%
+-commutative90.0%
Simplified90.0%
if 1.35000000000000003e154 < x Initial program 4.9%
flip3--4.9%
div-inv4.9%
rem-cube-cbrt2.9%
rem-cube-cbrt4.9%
cbrt-unprod4.9%
pow24.9%
distribute-rgt-out4.9%
+-commutative4.9%
Applied egg-rr4.9%
associate-*r/4.9%
*-rgt-identity4.9%
+-commutative4.9%
associate--l+4.9%
+-inverses4.9%
metadata-eval4.9%
+-commutative4.9%
fma-def4.9%
+-commutative4.9%
+-commutative4.9%
Simplified4.9%
add-exp-log4.9%
pow1/34.9%
log-pow4.9%
log-pow92.5%
log1p-udef92.5%
Applied egg-rr92.5%
associate-*r*92.5%
metadata-eval92.5%
Simplified92.5%
Final simplification90.4%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ (cbrt x) (cbrt (+ 1.0 x)))))
(if (<= x -1.0)
(/ 1.0 (fma (cbrt x) t_0 (cbrt (* x x))))
(/ 1.0 (fma (cbrt x) t_0 (exp (* 0.6666666666666666 (log1p x))))))))
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, cbrt((x * x)));
} else {
tmp = 1.0 / fma(cbrt(x), t_0, exp((0.6666666666666666 * log1p(x))));
}
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, cbrt(Float64(x * x)))); else tmp = Float64(1.0 / fma(cbrt(x), t_0, exp(Float64(0.6666666666666666 * log1p(x))))); 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 + 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[Exp[N[(0.6666666666666666 * N[Log[1 + x], $MachinePrecision]), $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, \sqrt[3]{x \cdot x}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_0, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)}\\
\end{array}
\end{array}
if x < -1Initial program 9.5%
flip3--9.5%
div-inv9.5%
rem-cube-cbrt9.9%
rem-cube-cbrt12.0%
cbrt-unprod12.0%
pow212.0%
distribute-rgt-out12.0%
+-commutative12.0%
Applied egg-rr12.0%
associate-*r/12.0%
*-rgt-identity12.0%
+-commutative12.0%
associate--l+55.8%
+-inverses55.8%
metadata-eval55.8%
+-commutative55.8%
fma-def55.8%
+-commutative55.8%
+-commutative55.8%
Simplified55.8%
add-exp-log54.1%
pow1/353.7%
log-pow53.8%
log-pow0.0%
log1p-udef0.0%
Applied egg-rr0.0%
associate-*r*0.0%
metadata-eval0.0%
Simplified0.0%
Taylor expanded in x around inf 49.5%
unpow1/351.8%
unpow251.8%
Simplified51.8%
if -1 < x Initial program 67.0%
flip3--66.9%
div-inv66.9%
rem-cube-cbrt66.5%
rem-cube-cbrt67.6%
cbrt-unprod67.7%
pow267.7%
distribute-rgt-out67.7%
+-commutative67.7%
Applied egg-rr67.7%
associate-*r/67.7%
*-rgt-identity67.7%
+-commutative67.7%
associate--l+83.2%
+-inverses83.2%
metadata-eval83.2%
+-commutative83.2%
fma-def83.2%
+-commutative83.2%
+-commutative83.2%
Simplified83.2%
add-exp-log82.6%
pow1/382.5%
log-pow82.5%
log-pow97.7%
log1p-udef97.7%
Applied egg-rr97.7%
associate-*r*97.7%
metadata-eval97.7%
Simplified97.7%
Final simplification89.1%
(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 56.2%
flip3--56.2%
div-inv56.2%
rem-cube-cbrt55.9%
rem-cube-cbrt57.2%
cbrt-unprod57.2%
pow257.2%
distribute-rgt-out57.2%
+-commutative57.2%
Applied egg-rr57.2%
associate-*r/57.2%
*-rgt-identity57.2%
+-commutative57.2%
associate--l+78.1%
+-inverses78.1%
metadata-eval78.1%
+-commutative78.1%
fma-def78.1%
+-commutative78.1%
+-commutative78.1%
Simplified78.1%
expm1-log1p-u77.3%
expm1-udef77.2%
Applied egg-rr97.3%
expm1-def97.3%
expm1-log1p99.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 (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.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.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.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:\\
\;\;\;\;\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 < -1Initial program 9.5%
flip3--9.5%
div-inv9.5%
rem-cube-cbrt9.9%
rem-cube-cbrt12.0%
cbrt-unprod12.0%
pow212.0%
distribute-rgt-out12.0%
+-commutative12.0%
Applied egg-rr12.0%
associate-*r/12.0%
*-rgt-identity12.0%
+-commutative12.0%
associate--l+55.8%
+-inverses55.8%
metadata-eval55.8%
+-commutative55.8%
fma-def55.8%
+-commutative55.8%
+-commutative55.8%
Simplified55.8%
add-exp-log54.1%
pow1/353.7%
log-pow53.8%
log-pow0.0%
log1p-udef0.0%
Applied egg-rr0.0%
associate-*r*0.0%
metadata-eval0.0%
Simplified0.0%
Taylor expanded in x around inf 49.5%
unpow1/351.8%
unpow251.8%
Simplified51.8%
if -1 < x Initial program 67.0%
flip3--66.9%
div-inv66.9%
rem-cube-cbrt66.5%
rem-cube-cbrt67.6%
cbrt-unprod67.7%
pow267.7%
distribute-rgt-out67.7%
+-commutative67.7%
Applied egg-rr67.7%
associate-*r/67.7%
*-rgt-identity67.7%
+-commutative67.7%
associate--l+83.2%
+-inverses83.2%
metadata-eval83.2%
+-commutative83.2%
fma-def83.2%
+-commutative83.2%
+-commutative83.2%
Simplified83.2%
pow1/382.4%
pow-pow97.4%
metadata-eval97.4%
Applied egg-rr97.4%
Final simplification88.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 56.2%
Final simplification56.2%
(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(1.0 + Float64(Float64(x * 0.3333333333333333) - cbrt(x))) end
code[x_] := N[(1.0 + N[(N[(x * 0.3333333333333333), $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \left(x \cdot 0.3333333333333333 - \sqrt[3]{x}\right)
\end{array}
Initial program 56.2%
add-cube-cbrt56.0%
pow356.0%
Applied egg-rr56.0%
Taylor expanded in x around 0 30.0%
associate--l+30.0%
*-commutative30.0%
metadata-eval30.0%
pow-base-130.0%
unpow1/353.6%
*-lft-identity53.6%
Simplified53.6%
Final simplification53.6%
(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 56.2%
add-cube-cbrt56.0%
pow356.0%
Applied egg-rr56.0%
Taylor expanded in x around 0 28.6%
metadata-eval28.6%
pow-base-128.6%
unpow1/352.8%
*-lft-identity52.8%
Simplified52.8%
Final simplification52.8%
(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 56.2%
Taylor expanded in x around inf 3.6%
Final simplification3.6%
(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 56.2%
Taylor expanded in x around 0 52.0%
Final simplification52.0%
herbie shell --seed 2023240
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
(- (cbrt (+ x 1.0)) (cbrt x)))