
(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
(+
(pow t_0 2.0)
(/
(cbrt x)
(/ (fma t_0 (- t_0 (cbrt x)) (pow (cbrt x) 2.0)) (+ x (+ 1.0 x))))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / (pow(t_0, 2.0) + (cbrt(x) / (fma(t_0, (t_0 - cbrt(x)), pow(cbrt(x), 2.0)) / (x + (1.0 + x)))));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / Float64((t_0 ^ 2.0) + Float64(cbrt(x) / Float64(fma(t_0, Float64(t_0 - cbrt(x)), (cbrt(x) ^ 2.0)) / Float64(x + Float64(1.0 + x)))))) end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, N[(1.0 / N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] / N[(N[(t$95$0 * N[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(x + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\frac{1}{{t_0}^{2} + \frac{\sqrt[3]{x}}{\frac{\mathsf{fma}\left(t_0, t_0 - \sqrt[3]{x}, {\left(\sqrt[3]{x}\right)}^{2}\right)}{x + \left(1 + x\right)}}}
\end{array}
\end{array}
Initial program 51.7%
flip3--52.0%
div-inv52.0%
rem-cube-cbrt51.7%
rem-cube-cbrt53.5%
cbrt-unprod53.5%
pow253.5%
distribute-rgt-out53.6%
+-commutative53.6%
Applied egg-rr53.6%
associate-*r/53.6%
*-rgt-identity53.6%
+-commutative53.6%
associate--l+73.6%
+-inverses73.6%
metadata-eval73.6%
+-commutative73.6%
fma-def73.6%
+-commutative73.6%
+-commutative73.6%
Simplified73.6%
fma-udef73.6%
pow1/372.6%
unpow272.6%
pow-prod-down72.7%
+-commutative72.7%
pow1/373.1%
+-commutative73.1%
pow1/399.1%
+-commutative99.1%
pow299.1%
+-commutative99.1%
+-commutative99.1%
Applied egg-rr99.1%
flip3-+99.1%
associate-*r/84.8%
rem-cube-cbrt85.0%
pow385.1%
add-cube-cbrt85.3%
+-commutative85.3%
Applied egg-rr85.2%
associate-/l*99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(if (<= (- t_0 (cbrt x)) 0.0)
(/ 1.0 (+ 1.0 (* (cbrt x) (+ t_0 (cbrt x)))))
(- (cbrt (/ 1.0 (/ (- 1.0 x) (- 1.0 (* x x))))) (cbrt x)))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double tmp;
if ((t_0 - cbrt(x)) <= 0.0) {
tmp = 1.0 / (1.0 + (cbrt(x) * (t_0 + cbrt(x))));
} else {
tmp = cbrt((1.0 / ((1.0 - x) / (1.0 - (x * x))))) - cbrt(x);
}
return tmp;
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
double tmp;
if ((t_0 - Math.cbrt(x)) <= 0.0) {
tmp = 1.0 / (1.0 + (Math.cbrt(x) * (t_0 + Math.cbrt(x))));
} else {
tmp = Math.cbrt((1.0 / ((1.0 - x) / (1.0 - (x * x))))) - Math.cbrt(x);
}
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 / Float64(1.0 + Float64(cbrt(x) * Float64(t_0 + cbrt(x))))); else tmp = Float64(cbrt(Float64(1.0 / Float64(Float64(1.0 - x) / Float64(1.0 - Float64(x * x))))) - cbrt(x)); 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[(1.0 + N[(N[Power[x, 1/3], $MachinePrecision] * N[(t$95$0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(1.0 / N[(N[(1.0 - x), $MachinePrecision] / N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $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}{1 + \sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{1}{\frac{1 - x}{1 - x \cdot x}}} - \sqrt[3]{x}\\
\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-cbrt5.8%
cbrt-unprod5.8%
pow25.8%
distribute-rgt-out5.8%
+-commutative5.8%
Applied egg-rr5.8%
associate-*r/5.8%
*-rgt-identity5.8%
+-commutative5.8%
associate--l+46.5%
+-inverses46.5%
metadata-eval46.5%
+-commutative46.5%
fma-def46.5%
+-commutative46.5%
+-commutative46.5%
Simplified46.5%
Taylor expanded in x around 0 20.0%
fma-udef20.0%
Applied egg-rr20.0%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 97.7%
add-exp-log96.9%
pow1/396.9%
log-pow97.0%
+-commutative97.0%
log1p-udef97.0%
Applied egg-rr97.0%
*-commutative97.0%
exp-prod96.8%
unpow1/396.9%
Simplified96.9%
log1p-udef96.9%
add-exp-log97.7%
flip-+97.7%
clear-num97.7%
metadata-eval97.7%
Applied egg-rr97.7%
Final simplification59.5%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (+ t_0 (cbrt x))))
(if (<= x -1.35e+154)
(/ 1.0 (+ 1.0 (* (cbrt x) t_1)))
(if (<= x 1.35e+154)
(/ 1.0 (+ (pow t_0 2.0) (+ (cbrt (* x x)) (cbrt (+ x (* x x))))))
(/ 1.0 (fma (cbrt x) t_1 (pow (+ 1.0 x) 0.6666666666666666)))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double t_1 = t_0 + cbrt(x);
double tmp;
if (x <= -1.35e+154) {
tmp = 1.0 / (1.0 + (cbrt(x) * t_1));
} else if (x <= 1.35e+154) {
tmp = 1.0 / (pow(t_0, 2.0) + (cbrt((x * x)) + cbrt((x + (x * x)))));
} else {
tmp = 1.0 / fma(cbrt(x), t_1, pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) t_1 = Float64(t_0 + cbrt(x)) tmp = 0.0 if (x <= -1.35e+154) tmp = Float64(1.0 / Float64(1.0 + Float64(cbrt(x) * t_1))); elseif (x <= 1.35e+154) tmp = Float64(1.0 / Float64((t_0 ^ 2.0) + Float64(cbrt(Float64(x * x)) + cbrt(Float64(x + Float64(x * x)))))); else tmp = Float64(1.0 / fma(cbrt(x), t_1, (Float64(1.0 + x) ^ 0.6666666666666666))); 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[x, -1.35e+154], N[(1.0 / N[(1.0 + N[(N[Power[x, 1/3], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.35e+154], N[(1.0 / N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[(N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * 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]{1 + x}\\
t_1 := t_0 + \sqrt[3]{x}\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{1 + \sqrt[3]{x} \cdot t_1}\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{{t_0}^{2} + \left(\sqrt[3]{x \cdot x} + \sqrt[3]{x + x \cdot x}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_1, {\left(1 + x\right)}^{0.6666666666666666}\right)}\\
\end{array}
\end{array}
if x < -1.35000000000000003e154Initial program 4.8%
flip3--4.8%
div-inv4.8%
rem-cube-cbrt3.6%
rem-cube-cbrt4.8%
cbrt-unprod4.8%
pow24.8%
distribute-rgt-out4.8%
+-commutative4.8%
Applied egg-rr4.8%
associate-*r/4.8%
*-rgt-identity4.8%
+-commutative4.8%
associate--l+4.8%
+-inverses4.8%
metadata-eval4.8%
+-commutative4.8%
fma-def4.8%
+-commutative4.8%
+-commutative4.8%
Simplified4.8%
Taylor expanded in x around 0 19.9%
fma-udef19.9%
Applied egg-rr19.9%
if -1.35000000000000003e154 < x < 1.35000000000000003e154Initial program 69.3%
flip3--69.8%
div-inv69.8%
rem-cube-cbrt70.0%
rem-cube-cbrt71.8%
cbrt-unprod71.9%
pow271.9%
distribute-rgt-out71.9%
+-commutative71.9%
Applied egg-rr71.9%
associate-*r/71.9%
*-rgt-identity71.9%
+-commutative71.9%
associate--l+99.5%
+-inverses99.5%
metadata-eval99.5%
+-commutative99.5%
fma-def99.5%
+-commutative99.5%
+-commutative99.5%
Simplified99.5%
fma-udef99.5%
pow1/398.2%
unpow298.2%
pow-prod-down80.3%
+-commutative80.3%
pow1/380.5%
+-commutative80.5%
pow1/399.4%
+-commutative99.4%
+-commutative99.4%
+-commutative99.4%
distribute-rgt-in99.4%
associate-+r+99.3%
Applied egg-rr99.6%
associate-+l+99.6%
*-commutative99.6%
distribute-lft-in99.6%
*-rgt-identity99.6%
Simplified99.6%
if 1.35000000000000003e154 < x Initial program 4.8%
flip3--4.8%
div-inv4.8%
rem-cube-cbrt2.8%
rem-cube-cbrt4.8%
cbrt-unprod4.8%
pow24.8%
distribute-rgt-out4.8%
+-commutative4.8%
Applied egg-rr4.8%
associate-*r/4.8%
*-rgt-identity4.8%
+-commutative4.8%
associate--l+4.8%
+-inverses4.8%
metadata-eval4.8%
+-commutative4.8%
fma-def4.8%
+-commutative4.8%
+-commutative4.8%
Simplified4.8%
pow1/34.8%
pow-pow91.6%
metadata-eval91.6%
Applied egg-rr91.6%
Final simplification89.0%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x)))) (/ 1.0 (+ (pow t_0 2.0) (* (cbrt x) (+ t_0 (cbrt x)))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / (pow(t_0, 2.0) + (cbrt(x) * (t_0 + cbrt(x))));
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
return 1.0 / (Math.pow(t_0, 2.0) + (Math.cbrt(x) * (t_0 + Math.cbrt(x))));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / Float64((t_0 ^ 2.0) + Float64(cbrt(x) * Float64(t_0 + cbrt(x))))) end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, N[(1.0 / N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * N[(t$95$0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\frac{1}{{t_0}^{2} + \sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right)}
\end{array}
\end{array}
Initial program 51.7%
flip3--52.0%
div-inv52.0%
rem-cube-cbrt51.7%
rem-cube-cbrt53.5%
cbrt-unprod53.5%
pow253.5%
distribute-rgt-out53.6%
+-commutative53.6%
Applied egg-rr53.6%
associate-*r/53.6%
*-rgt-identity53.6%
+-commutative53.6%
associate--l+73.6%
+-inverses73.6%
metadata-eval73.6%
+-commutative73.6%
fma-def73.6%
+-commutative73.6%
+-commutative73.6%
Simplified73.6%
fma-udef73.6%
pow1/372.6%
unpow272.6%
pow-prod-down72.7%
+-commutative72.7%
pow1/373.1%
+-commutative73.1%
pow1/399.1%
+-commutative99.1%
pow299.1%
+-commutative99.1%
+-commutative99.1%
Applied egg-rr99.1%
Final simplification99.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(if (or (<= x -1.35e+154) (not (<= x 1.35e+154)))
(/ 1.0 (+ 1.0 (* (cbrt x) (+ t_0 (cbrt x)))))
(/ 1.0 (+ (+ (pow t_0 2.0) (cbrt (* x x))) (cbrt (* x (+ 1.0 x))))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double tmp;
if ((x <= -1.35e+154) || !(x <= 1.35e+154)) {
tmp = 1.0 / (1.0 + (cbrt(x) * (t_0 + cbrt(x))));
} else {
tmp = 1.0 / ((pow(t_0, 2.0) + cbrt((x * x))) + cbrt((x * (1.0 + x))));
}
return tmp;
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
double tmp;
if ((x <= -1.35e+154) || !(x <= 1.35e+154)) {
tmp = 1.0 / (1.0 + (Math.cbrt(x) * (t_0 + Math.cbrt(x))));
} else {
tmp = 1.0 / ((Math.pow(t_0, 2.0) + Math.cbrt((x * x))) + Math.cbrt((x * (1.0 + x))));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) tmp = 0.0 if ((x <= -1.35e+154) || !(x <= 1.35e+154)) tmp = Float64(1.0 / Float64(1.0 + Float64(cbrt(x) * Float64(t_0 + cbrt(x))))); else tmp = Float64(1.0 / Float64(Float64((t_0 ^ 2.0) + cbrt(Float64(x * x))) + cbrt(Float64(x * Float64(1.0 + x))))); end return tmp end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, If[Or[LessEqual[x, -1.35e+154], N[Not[LessEqual[x, 1.35e+154]], $MachinePrecision]], N[(1.0 / N[(1.0 + N[(N[Power[x, 1/3], $MachinePrecision] * N[(t$95$0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[N[(x * N[(1.0 + x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154} \lor \neg \left(x \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;\frac{1}{1 + \sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left({t_0}^{2} + \sqrt[3]{x \cdot x}\right) + \sqrt[3]{x \cdot \left(1 + x\right)}}\\
\end{array}
\end{array}
if x < -1.35000000000000003e154 or 1.35000000000000003e154 < x Initial program 4.8%
flip3--4.8%
div-inv4.8%
rem-cube-cbrt3.2%
rem-cube-cbrt4.8%
cbrt-unprod4.8%
pow24.8%
distribute-rgt-out4.8%
+-commutative4.8%
Applied egg-rr4.8%
associate-*r/4.8%
*-rgt-identity4.8%
+-commutative4.8%
associate--l+4.8%
+-inverses4.8%
metadata-eval4.8%
+-commutative4.8%
fma-def4.8%
+-commutative4.8%
+-commutative4.8%
Simplified4.8%
Taylor expanded in x around 0 20.0%
fma-udef20.0%
Applied egg-rr20.0%
if -1.35000000000000003e154 < x < 1.35000000000000003e154Initial program 69.3%
flip3--69.8%
div-inv69.8%
rem-cube-cbrt70.0%
rem-cube-cbrt71.8%
cbrt-unprod71.9%
pow271.9%
distribute-rgt-out71.9%
+-commutative71.9%
Applied egg-rr71.9%
associate-*r/71.9%
*-rgt-identity71.9%
+-commutative71.9%
associate--l+99.5%
+-inverses99.5%
metadata-eval99.5%
+-commutative99.5%
fma-def99.5%
+-commutative99.5%
+-commutative99.5%
Simplified99.5%
fma-udef99.5%
pow1/398.2%
unpow298.2%
pow-prod-down80.3%
+-commutative80.3%
pow1/380.5%
+-commutative80.5%
pow1/399.4%
+-commutative99.4%
+-commutative99.4%
+-commutative99.4%
distribute-rgt-in99.4%
associate-+r+99.3%
Applied egg-rr99.6%
Final simplification77.8%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(if (or (<= x -1.35e+154) (not (<= x 1.35e+154)))
(/ 1.0 (+ 1.0 (* (cbrt x) (+ t_0 (cbrt x)))))
(/ 1.0 (+ (pow t_0 2.0) (+ (cbrt (* x x)) (cbrt (+ x (* x x)))))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double tmp;
if ((x <= -1.35e+154) || !(x <= 1.35e+154)) {
tmp = 1.0 / (1.0 + (cbrt(x) * (t_0 + cbrt(x))));
} else {
tmp = 1.0 / (pow(t_0, 2.0) + (cbrt((x * x)) + cbrt((x + (x * x)))));
}
return tmp;
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
double tmp;
if ((x <= -1.35e+154) || !(x <= 1.35e+154)) {
tmp = 1.0 / (1.0 + (Math.cbrt(x) * (t_0 + Math.cbrt(x))));
} else {
tmp = 1.0 / (Math.pow(t_0, 2.0) + (Math.cbrt((x * x)) + Math.cbrt((x + (x * x)))));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) tmp = 0.0 if ((x <= -1.35e+154) || !(x <= 1.35e+154)) tmp = Float64(1.0 / Float64(1.0 + Float64(cbrt(x) * Float64(t_0 + cbrt(x))))); else tmp = Float64(1.0 / Float64((t_0 ^ 2.0) + Float64(cbrt(Float64(x * x)) + cbrt(Float64(x + Float64(x * x)))))); end return tmp end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, If[Or[LessEqual[x, -1.35e+154], N[Not[LessEqual[x, 1.35e+154]], $MachinePrecision]], N[(1.0 / N[(1.0 + N[(N[Power[x, 1/3], $MachinePrecision] * N[(t$95$0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[(N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154} \lor \neg \left(x \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;\frac{1}{1 + \sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{t_0}^{2} + \left(\sqrt[3]{x \cdot x} + \sqrt[3]{x + x \cdot x}\right)}\\
\end{array}
\end{array}
if x < -1.35000000000000003e154 or 1.35000000000000003e154 < x Initial program 4.8%
flip3--4.8%
div-inv4.8%
rem-cube-cbrt3.2%
rem-cube-cbrt4.8%
cbrt-unprod4.8%
pow24.8%
distribute-rgt-out4.8%
+-commutative4.8%
Applied egg-rr4.8%
associate-*r/4.8%
*-rgt-identity4.8%
+-commutative4.8%
associate--l+4.8%
+-inverses4.8%
metadata-eval4.8%
+-commutative4.8%
fma-def4.8%
+-commutative4.8%
+-commutative4.8%
Simplified4.8%
Taylor expanded in x around 0 20.0%
fma-udef20.0%
Applied egg-rr20.0%
if -1.35000000000000003e154 < x < 1.35000000000000003e154Initial program 69.3%
flip3--69.8%
div-inv69.8%
rem-cube-cbrt70.0%
rem-cube-cbrt71.8%
cbrt-unprod71.9%
pow271.9%
distribute-rgt-out71.9%
+-commutative71.9%
Applied egg-rr71.9%
associate-*r/71.9%
*-rgt-identity71.9%
+-commutative71.9%
associate--l+99.5%
+-inverses99.5%
metadata-eval99.5%
+-commutative99.5%
fma-def99.5%
+-commutative99.5%
+-commutative99.5%
Simplified99.5%
fma-udef99.5%
pow1/398.2%
unpow298.2%
pow-prod-down80.3%
+-commutative80.3%
pow1/380.5%
+-commutative80.5%
pow1/399.4%
+-commutative99.4%
+-commutative99.4%
+-commutative99.4%
distribute-rgt-in99.4%
associate-+r+99.3%
Applied egg-rr99.6%
associate-+l+99.6%
*-commutative99.6%
distribute-lft-in99.6%
*-rgt-identity99.6%
Simplified99.6%
Final simplification77.8%
(FPCore (x) :precision binary64 (fabs (- (cbrt (+ 1.0 x)) (cbrt x))))
double code(double x) {
return fabs((cbrt((1.0 + x)) - cbrt(x)));
}
public static double code(double x) {
return Math.abs((Math.cbrt((1.0 + x)) - Math.cbrt(x)));
}
function code(x) return abs(Float64(cbrt(Float64(1.0 + x)) - cbrt(x))) end
code[x_] := N[Abs[N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\sqrt[3]{1 + x} - \sqrt[3]{x}\right|
\end{array}
Initial program 51.7%
pow1/327.0%
Applied egg-rr27.0%
pow1/351.7%
add-sqr-sqrt51.6%
sqrt-prod51.8%
rem-sqrt-square51.8%
+-commutative51.8%
Applied egg-rr51.8%
Final simplification51.8%
(FPCore (x) :precision binary64 (- (cbrt (- (/ x (/ (+ x -1.0) x)) (/ 1.0 (+ x -1.0)))) (cbrt x)))
double code(double x) {
return cbrt(((x / ((x + -1.0) / x)) - (1.0 / (x + -1.0)))) - cbrt(x);
}
public static double code(double x) {
return Math.cbrt(((x / ((x + -1.0) / x)) - (1.0 / (x + -1.0)))) - Math.cbrt(x);
}
function code(x) return Float64(cbrt(Float64(Float64(x / Float64(Float64(x + -1.0) / x)) - Float64(1.0 / Float64(x + -1.0)))) - cbrt(x)) end
code[x_] := N[(N[Power[N[(N[(x / N[(N[(x + -1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{x}{\frac{x + -1}{x}} - \frac{1}{x + -1}} - \sqrt[3]{x}
\end{array}
Initial program 51.7%
add-exp-log50.1%
pow1/349.8%
log-pow49.9%
+-commutative49.9%
log1p-udef49.9%
Applied egg-rr49.9%
*-commutative49.9%
exp-prod49.7%
unpow1/350.0%
Simplified50.0%
log1p-udef50.0%
+-commutative50.0%
add-exp-log51.7%
flip-+50.8%
metadata-eval50.8%
div-sub50.8%
sub-neg50.8%
metadata-eval50.8%
sub-neg50.8%
metadata-eval50.8%
Applied egg-rr50.8%
associate-/l*51.7%
Simplified51.7%
Final simplification51.7%
(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 51.7%
Final simplification51.7%
(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 51.7%
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 51.7%
Taylor expanded in x around 0 48.4%
Final simplification48.4%
herbie shell --seed 2023192
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
(- (cbrt (+ x 1.0)) (cbrt x)))