
(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 15 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 x) (cbrt (+ 1.0 x)))))
(if (<= x 5e+152)
(/ 1.0 (fma (cbrt x) t_0 (cbrt (pow (+ 1.0 x) 2.0))))
(/ 1.0 (+ (pow (cbrt x) 2.0) (* (cbrt x) t_0))))))
double code(double x) {
double t_0 = cbrt(x) + cbrt((1.0 + x));
double tmp;
if (x <= 5e+152) {
tmp = 1.0 / fma(cbrt(x), t_0, cbrt(pow((1.0 + x), 2.0)));
} else {
tmp = 1.0 / (pow(cbrt(x), 2.0) + (cbrt(x) * t_0));
}
return tmp;
}
function code(x) t_0 = Float64(cbrt(x) + cbrt(Float64(1.0 + x))) tmp = 0.0 if (x <= 5e+152) tmp = Float64(1.0 / fma(cbrt(x), t_0, cbrt((Float64(1.0 + x) ^ 2.0)))); else tmp = Float64(1.0 / Float64((cbrt(x) ^ 2.0) + Float64(cbrt(x) * t_0))); 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, 5e+152], 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[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{x} + \sqrt[3]{1 + x}\\
\mathbf{if}\;x \leq 5 \cdot 10^{+152}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t\_0, \sqrt[3]{{\left(1 + x\right)}^{2}}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{\left(\sqrt[3]{x}\right)}^{2} + \sqrt[3]{x} \cdot t\_0}\\
\end{array}
\end{array}
if x < 5e152Initial program 11.6%
flip3--11.9%
div-inv11.9%
rem-cube-cbrt14.0%
rem-cube-cbrt17.6%
+-commutative17.6%
distribute-rgt-out17.7%
+-commutative17.7%
fma-define17.7%
add-exp-log17.5%
Applied egg-rr17.4%
associate-*r/17.4%
*-rgt-identity17.4%
+-commutative17.4%
associate--l+94.7%
+-inverses94.7%
metadata-eval94.7%
+-commutative94.7%
exp-prod93.8%
Simplified93.8%
pow-exp94.7%
*-commutative94.7%
log1p-undefine94.7%
+-commutative94.7%
exp-to-pow94.6%
metadata-eval94.6%
pow-prod-up94.6%
pow1/395.9%
pow1/398.6%
cbrt-unprod98.9%
pow298.9%
Applied egg-rr98.9%
if 5e152 < x Initial program 4.7%
flip3--4.7%
div-inv4.7%
rem-cube-cbrt3.1%
rem-cube-cbrt4.7%
+-commutative4.7%
distribute-rgt-out4.7%
+-commutative4.7%
fma-define4.7%
add-exp-log4.7%
Applied egg-rr4.7%
associate-*r/4.7%
*-rgt-identity4.7%
+-commutative4.7%
associate--l+92.1%
+-inverses92.1%
metadata-eval92.1%
+-commutative92.1%
exp-prod91.2%
Simplified91.2%
Taylor expanded in x around inf 4.7%
fma-undefine4.7%
unpow24.7%
cbrt-prod98.5%
+-commutative98.5%
pow298.5%
+-commutative98.5%
+-commutative98.5%
Applied egg-rr98.5%
Final simplification98.7%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (sqrt (+ 1.0 x))))) (/ 1.0 (fma (cbrt x) (+ (cbrt x) (* t_0 t_0)) (pow (cbrt (+ 1.0 x)) 2.0)))))
double code(double x) {
double t_0 = cbrt(sqrt((1.0 + x)));
return 1.0 / fma(cbrt(x), (cbrt(x) + (t_0 * t_0)), pow(cbrt((1.0 + x)), 2.0));
}
function code(x) t_0 = cbrt(sqrt(Float64(1.0 + x))) return Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + Float64(t_0 * t_0)), (cbrt(Float64(1.0 + x)) ^ 2.0))) end
code[x_] := Block[{t$95$0 = N[Power[N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision]}, N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[Power[N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\sqrt{1 + x}}\\
\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t\_0 \cdot t\_0, {\left(\sqrt[3]{1 + x}\right)}^{2}\right)}
\end{array}
\end{array}
Initial program 8.2%
flip3--8.4%
div-inv8.4%
rem-cube-cbrt8.6%
rem-cube-cbrt11.2%
+-commutative11.2%
distribute-rgt-out11.2%
+-commutative11.2%
fma-define11.2%
add-exp-log11.2%
Applied egg-rr11.1%
associate-*r/11.1%
*-rgt-identity11.1%
+-commutative11.1%
associate--l+93.4%
+-inverses93.4%
metadata-eval93.4%
+-commutative93.4%
exp-prod92.5%
Simplified92.5%
pow-exp93.4%
*-commutative93.4%
log1p-undefine93.4%
+-commutative93.4%
exp-to-pow93.2%
metadata-eval93.2%
pow-sqr93.1%
pow1/394.6%
pow1/398.5%
Applied egg-rr98.5%
pow1/394.6%
+-commutative94.6%
add-sqr-sqrt94.6%
unpow-prod-down94.6%
Applied egg-rr94.6%
unpow1/395.9%
+-commutative95.9%
unpow1/398.6%
+-commutative98.6%
Simplified98.6%
pow298.6%
Applied egg-rr98.6%
Final simplification98.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ (cbrt x) (cbrt (+ 1.0 x)))))
(if (<= x 7e+16)
(/ 1.0 (fma (cbrt x) t_0 (pow (+ 1.0 x) 0.6666666666666666)))
(/ 1.0 (fma (cbrt x) t_0 (pow (cbrt x) 2.0))))))
double code(double x) {
double t_0 = cbrt(x) + cbrt((1.0 + x));
double tmp;
if (x <= 7e+16) {
tmp = 1.0 / fma(cbrt(x), t_0, pow((1.0 + x), 0.6666666666666666));
} else {
tmp = 1.0 / fma(cbrt(x), t_0, pow(cbrt(x), 2.0));
}
return tmp;
}
function code(x) t_0 = Float64(cbrt(x) + cbrt(Float64(1.0 + x))) tmp = 0.0 if (x <= 7e+16) tmp = Float64(1.0 / fma(cbrt(x), t_0, (Float64(1.0 + x) ^ 0.6666666666666666))); else tmp = Float64(1.0 / fma(cbrt(x), t_0, (cbrt(x) ^ 2.0))); 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, 7e+16], 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], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0 + N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{x} + \sqrt[3]{1 + x}\\
\mathbf{if}\;x \leq 7 \cdot 10^{+16}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t\_0, {\left(1 + x\right)}^{0.6666666666666666}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t\_0, {\left(\sqrt[3]{x}\right)}^{2}\right)}\\
\end{array}
\end{array}
if x < 7e16Initial program 55.0%
flip3--57.3%
div-inv57.3%
rem-cube-cbrt68.2%
rem-cube-cbrt94.1%
+-commutative94.1%
distribute-rgt-out94.1%
+-commutative94.1%
fma-define94.2%
add-exp-log93.3%
Applied egg-rr92.8%
associate-*r/92.8%
*-rgt-identity92.8%
+-commutative92.8%
associate--l+97.5%
+-inverses97.5%
metadata-eval97.5%
+-commutative97.5%
exp-prod97.5%
Simplified97.5%
pow-exp97.5%
*-commutative97.5%
log1p-undefine97.5%
+-commutative97.5%
exp-to-pow98.0%
metadata-eval98.0%
pow-sqr97.9%
pow1/398.7%
pow1/398.9%
Applied egg-rr98.9%
pow298.9%
pow1/397.9%
pow-pow98.0%
metadata-eval98.0%
Applied egg-rr98.0%
if 7e16 < x Initial program 4.2%
flip3--4.2%
div-inv4.2%
rem-cube-cbrt3.6%
rem-cube-cbrt4.2%
+-commutative4.2%
distribute-rgt-out4.2%
+-commutative4.2%
fma-define4.2%
add-exp-log4.2%
Applied egg-rr4.2%
associate-*r/4.2%
*-rgt-identity4.2%
+-commutative4.2%
associate--l+93.1%
+-inverses93.1%
metadata-eval93.1%
+-commutative93.1%
exp-prod92.0%
Simplified92.0%
Taylor expanded in x around inf 48.2%
unpow248.2%
cbrt-prod98.5%
*-un-lft-identity98.5%
pow298.5%
Applied egg-rr98.5%
*-lft-identity98.5%
Simplified98.5%
Final simplification98.5%
(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 8.2%
flip3--8.4%
div-inv8.4%
rem-cube-cbrt8.6%
rem-cube-cbrt11.2%
+-commutative11.2%
distribute-rgt-out11.2%
+-commutative11.2%
fma-define11.2%
add-exp-log11.2%
Applied egg-rr11.1%
associate-*r/11.1%
*-rgt-identity11.1%
+-commutative11.1%
associate--l+93.4%
+-inverses93.4%
metadata-eval93.4%
+-commutative93.4%
exp-prod92.5%
Simplified92.5%
pow-exp93.4%
*-commutative93.4%
log1p-undefine93.4%
+-commutative93.4%
exp-to-pow93.2%
metadata-eval93.2%
pow-sqr93.1%
pow1/394.6%
pow1/398.5%
Applied egg-rr98.5%
pow298.6%
Applied egg-rr98.5%
Final simplification98.5%
(FPCore (x)
:precision binary64
(if (<= x 2e+76)
(/
(fma
0.3333333333333333
(cbrt (pow x 4.0))
(* (cbrt x) -0.1111111111111111))
(pow x 2.0))
(/ 1.0 (+ (pow (cbrt x) 2.0) (* (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x))))))))
double code(double x) {
double tmp;
if (x <= 2e+76) {
tmp = fma(0.3333333333333333, cbrt(pow(x, 4.0)), (cbrt(x) * -0.1111111111111111)) / pow(x, 2.0);
} else {
tmp = 1.0 / (pow(cbrt(x), 2.0) + (cbrt(x) * (cbrt(x) + cbrt((1.0 + x)))));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 2e+76) tmp = Float64(fma(0.3333333333333333, cbrt((x ^ 4.0)), Float64(cbrt(x) * -0.1111111111111111)) / (x ^ 2.0)); else tmp = Float64(1.0 / Float64((cbrt(x) ^ 2.0) + Float64(cbrt(x) * Float64(cbrt(x) + cbrt(Float64(1.0 + x)))))); end return tmp end
code[x_] := If[LessEqual[x, 2e+76], N[(N[(0.3333333333333333 * N[Power[N[Power[x, 4.0], $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * -0.1111111111111111), $MachinePrecision]), $MachinePrecision] / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{+76}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.3333333333333333, \sqrt[3]{{x}^{4}}, \sqrt[3]{x} \cdot -0.1111111111111111\right)}{{x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{\left(\sqrt[3]{x}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right)}\\
\end{array}
\end{array}
if x < 2.0000000000000001e76Initial program 20.6%
Taylor expanded in x around inf 94.5%
+-commutative94.5%
fma-define94.5%
Simplified94.5%
if 2.0000000000000001e76 < x Initial program 4.4%
flip3--4.4%
div-inv4.4%
rem-cube-cbrt3.2%
rem-cube-cbrt4.4%
+-commutative4.4%
distribute-rgt-out4.4%
+-commutative4.4%
fma-define4.4%
add-exp-log4.4%
Applied egg-rr4.4%
associate-*r/4.4%
*-rgt-identity4.4%
+-commutative4.4%
associate--l+92.6%
+-inverses92.6%
metadata-eval92.6%
+-commutative92.6%
exp-prod91.6%
Simplified91.6%
Taylor expanded in x around inf 37.9%
fma-undefine37.8%
unpow237.8%
cbrt-prod98.5%
+-commutative98.5%
pow298.5%
+-commutative98.5%
+-commutative98.5%
Applied egg-rr98.5%
Final simplification97.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ (cbrt x) (cbrt (+ 1.0 x)))))
(if (<= x 7e+16)
(/ 1.0 (fma (cbrt x) t_0 (pow (+ 1.0 x) 0.6666666666666666)))
(/ 1.0 (+ (pow (cbrt x) 2.0) (* (cbrt x) t_0))))))
double code(double x) {
double t_0 = cbrt(x) + cbrt((1.0 + x));
double tmp;
if (x <= 7e+16) {
tmp = 1.0 / fma(cbrt(x), t_0, pow((1.0 + x), 0.6666666666666666));
} else {
tmp = 1.0 / (pow(cbrt(x), 2.0) + (cbrt(x) * t_0));
}
return tmp;
}
function code(x) t_0 = Float64(cbrt(x) + cbrt(Float64(1.0 + x))) tmp = 0.0 if (x <= 7e+16) tmp = Float64(1.0 / fma(cbrt(x), t_0, (Float64(1.0 + x) ^ 0.6666666666666666))); else tmp = Float64(1.0 / Float64((cbrt(x) ^ 2.0) + Float64(cbrt(x) * t_0))); 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, 7e+16], 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], N[(1.0 / N[(N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{x} + \sqrt[3]{1 + x}\\
\mathbf{if}\;x \leq 7 \cdot 10^{+16}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t\_0, {\left(1 + x\right)}^{0.6666666666666666}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{\left(\sqrt[3]{x}\right)}^{2} + \sqrt[3]{x} \cdot t\_0}\\
\end{array}
\end{array}
if x < 7e16Initial program 55.0%
flip3--57.3%
div-inv57.3%
rem-cube-cbrt68.2%
rem-cube-cbrt94.1%
+-commutative94.1%
distribute-rgt-out94.1%
+-commutative94.1%
fma-define94.2%
add-exp-log93.3%
Applied egg-rr92.8%
associate-*r/92.8%
*-rgt-identity92.8%
+-commutative92.8%
associate--l+97.5%
+-inverses97.5%
metadata-eval97.5%
+-commutative97.5%
exp-prod97.5%
Simplified97.5%
pow-exp97.5%
*-commutative97.5%
log1p-undefine97.5%
+-commutative97.5%
exp-to-pow98.0%
metadata-eval98.0%
pow-sqr97.9%
pow1/398.7%
pow1/398.9%
Applied egg-rr98.9%
pow298.9%
pow1/397.9%
pow-pow98.0%
metadata-eval98.0%
Applied egg-rr98.0%
if 7e16 < x Initial program 4.2%
flip3--4.2%
div-inv4.2%
rem-cube-cbrt3.6%
rem-cube-cbrt4.2%
+-commutative4.2%
distribute-rgt-out4.2%
+-commutative4.2%
fma-define4.2%
add-exp-log4.2%
Applied egg-rr4.2%
associate-*r/4.2%
*-rgt-identity4.2%
+-commutative4.2%
associate--l+93.1%
+-inverses93.1%
metadata-eval93.1%
+-commutative93.1%
exp-prod92.0%
Simplified92.0%
Taylor expanded in x around inf 48.2%
fma-undefine48.2%
unpow248.2%
cbrt-prod98.5%
+-commutative98.5%
pow298.5%
+-commutative98.5%
+-commutative98.5%
Applied egg-rr98.5%
Final simplification98.5%
(FPCore (x)
:precision binary64
(if (<= x 2e+70)
(/
(fma
0.3333333333333333
(cbrt (pow x 4.0))
(* (cbrt x) -0.1111111111111111))
(pow x 2.0))
(/ 1.0 (* (cbrt x) (+ (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x))))))))
double code(double x) {
double tmp;
if (x <= 2e+70) {
tmp = fma(0.3333333333333333, cbrt(pow(x, 4.0)), (cbrt(x) * -0.1111111111111111)) / pow(x, 2.0);
} else {
tmp = 1.0 / (cbrt(x) * (cbrt(x) + (cbrt(x) + cbrt((1.0 + x)))));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 2e+70) tmp = Float64(fma(0.3333333333333333, cbrt((x ^ 4.0)), Float64(cbrt(x) * -0.1111111111111111)) / (x ^ 2.0)); else tmp = Float64(1.0 / Float64(cbrt(x) * Float64(cbrt(x) + Float64(cbrt(x) + cbrt(Float64(1.0 + x)))))); end return tmp end
code[x_] := If[LessEqual[x, 2e+70], N[(N[(0.3333333333333333 * N[Power[N[Power[x, 4.0], $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * -0.1111111111111111), $MachinePrecision]), $MachinePrecision] / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{+70}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.3333333333333333, \sqrt[3]{{x}^{4}}, \sqrt[3]{x} \cdot -0.1111111111111111\right)}{{x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right)\right)}\\
\end{array}
\end{array}
if x < 2.00000000000000015e70Initial program 20.6%
Taylor expanded in x around inf 94.5%
+-commutative94.5%
fma-define94.5%
Simplified94.5%
if 2.00000000000000015e70 < x Initial program 4.4%
flip3--4.4%
div-inv4.4%
rem-cube-cbrt3.2%
rem-cube-cbrt4.4%
+-commutative4.4%
distribute-rgt-out4.4%
+-commutative4.4%
fma-define4.4%
add-exp-log4.4%
Applied egg-rr4.4%
associate-*r/4.4%
*-rgt-identity4.4%
+-commutative4.4%
associate--l+92.6%
+-inverses92.6%
metadata-eval92.6%
+-commutative92.6%
exp-prod91.6%
Simplified91.6%
Taylor expanded in x around inf 37.9%
fma-undefine37.8%
+-commutative37.8%
+-commutative37.8%
unpow237.8%
cbrt-prod98.5%
pow298.5%
Applied egg-rr98.5%
+-commutative98.5%
unpow298.5%
distribute-lft-out98.5%
+-commutative98.5%
Simplified98.5%
Final simplification97.6%
(FPCore (x)
:precision binary64
(if (<= x 2e+70)
(/
(+
(* (cbrt x) -0.1111111111111111)
(* 0.3333333333333333 (cbrt (pow x 4.0))))
(pow x 2.0))
(/ 1.0 (* (cbrt x) (+ (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x))))))))
double code(double x) {
double tmp;
if (x <= 2e+70) {
tmp = ((cbrt(x) * -0.1111111111111111) + (0.3333333333333333 * cbrt(pow(x, 4.0)))) / pow(x, 2.0);
} else {
tmp = 1.0 / (cbrt(x) * (cbrt(x) + (cbrt(x) + cbrt((1.0 + x)))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 2e+70) {
tmp = ((Math.cbrt(x) * -0.1111111111111111) + (0.3333333333333333 * Math.cbrt(Math.pow(x, 4.0)))) / Math.pow(x, 2.0);
} else {
tmp = 1.0 / (Math.cbrt(x) * (Math.cbrt(x) + (Math.cbrt(x) + Math.cbrt((1.0 + x)))));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 2e+70) tmp = Float64(Float64(Float64(cbrt(x) * -0.1111111111111111) + Float64(0.3333333333333333 * cbrt((x ^ 4.0)))) / (x ^ 2.0)); else tmp = Float64(1.0 / Float64(cbrt(x) * Float64(cbrt(x) + Float64(cbrt(x) + cbrt(Float64(1.0 + x)))))); end return tmp end
code[x_] := If[LessEqual[x, 2e+70], N[(N[(N[(N[Power[x, 1/3], $MachinePrecision] * -0.1111111111111111), $MachinePrecision] + N[(0.3333333333333333 * N[Power[N[Power[x, 4.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{+70}:\\
\;\;\;\;\frac{\sqrt[3]{x} \cdot -0.1111111111111111 + 0.3333333333333333 \cdot \sqrt[3]{{x}^{4}}}{{x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right)\right)}\\
\end{array}
\end{array}
if x < 2.00000000000000015e70Initial program 20.6%
Taylor expanded in x around inf 94.5%
if 2.00000000000000015e70 < x Initial program 4.4%
flip3--4.4%
div-inv4.4%
rem-cube-cbrt3.2%
rem-cube-cbrt4.4%
+-commutative4.4%
distribute-rgt-out4.4%
+-commutative4.4%
fma-define4.4%
add-exp-log4.4%
Applied egg-rr4.4%
associate-*r/4.4%
*-rgt-identity4.4%
+-commutative4.4%
associate--l+92.6%
+-inverses92.6%
metadata-eval92.6%
+-commutative92.6%
exp-prod91.6%
Simplified91.6%
Taylor expanded in x around inf 37.9%
fma-undefine37.8%
+-commutative37.8%
+-commutative37.8%
unpow237.8%
cbrt-prod98.5%
pow298.5%
Applied egg-rr98.5%
+-commutative98.5%
unpow298.5%
distribute-lft-out98.5%
+-commutative98.5%
Simplified98.5%
Final simplification97.5%
(FPCore (x) :precision binary64 (if (<= x 1.32e+154) (* 0.3333333333333333 (cbrt (/ 1.0 (pow x 2.0)))) (/ 1.0 (fma (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x))) 1.0))))
double code(double x) {
double tmp;
if (x <= 1.32e+154) {
tmp = 0.3333333333333333 * cbrt((1.0 / pow(x, 2.0)));
} else {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + cbrt((1.0 + x))), 1.0);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.32e+154) tmp = Float64(0.3333333333333333 * cbrt(Float64(1.0 / (x ^ 2.0)))); else tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(Float64(1.0 + x))), 1.0)); end return tmp end
code[x_] := If[LessEqual[x, 1.32e+154], N[(0.3333333333333333 * N[Power[N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt[3]{\frac{1}{{x}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, 1\right)}\\
\end{array}
\end{array}
if x < 1.31999999999999998e154Initial program 11.6%
Taylor expanded in x around inf 93.2%
if 1.31999999999999998e154 < x Initial program 4.7%
flip3--4.7%
div-inv4.7%
rem-cube-cbrt3.1%
rem-cube-cbrt4.7%
+-commutative4.7%
distribute-rgt-out4.7%
+-commutative4.7%
fma-define4.7%
add-exp-log4.7%
Applied egg-rr4.7%
associate-*r/4.7%
*-rgt-identity4.7%
+-commutative4.7%
associate--l+92.1%
+-inverses92.1%
metadata-eval92.1%
+-commutative92.1%
exp-prod91.2%
Simplified91.2%
Taylor expanded in x around 0 19.9%
Final simplification56.9%
(FPCore (x) :precision binary64 (/ 1.0 (* (cbrt x) (+ (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x)))))))
double code(double x) {
return 1.0 / (cbrt(x) * (cbrt(x) + (cbrt(x) + cbrt((1.0 + x)))));
}
public static double code(double x) {
return 1.0 / (Math.cbrt(x) * (Math.cbrt(x) + (Math.cbrt(x) + Math.cbrt((1.0 + x)))));
}
function code(x) return Float64(1.0 / Float64(cbrt(x) * Float64(cbrt(x) + Float64(cbrt(x) + cbrt(Float64(1.0 + x)))))) end
code[x_] := N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right)\right)}
\end{array}
Initial program 8.2%
flip3--8.4%
div-inv8.4%
rem-cube-cbrt8.6%
rem-cube-cbrt11.2%
+-commutative11.2%
distribute-rgt-out11.2%
+-commutative11.2%
fma-define11.2%
add-exp-log11.2%
Applied egg-rr11.1%
associate-*r/11.1%
*-rgt-identity11.1%
+-commutative11.1%
associate--l+93.4%
+-inverses93.4%
metadata-eval93.4%
+-commutative93.4%
exp-prod92.5%
Simplified92.5%
Taylor expanded in x around inf 49.4%
fma-undefine49.4%
+-commutative49.4%
+-commutative49.4%
unpow249.4%
cbrt-prod95.8%
pow295.8%
Applied egg-rr95.8%
+-commutative95.8%
unpow295.8%
distribute-lft-out95.8%
+-commutative95.8%
Simplified95.8%
Final simplification95.8%
(FPCore (x) :precision binary64 (if (<= x 1.32e+154) (* 0.3333333333333333 (cbrt (/ 1.0 (pow x 2.0)))) (/ 1.0 (+ 1.0 (* (cbrt x) (+ 1.0 (cbrt x)))))))
double code(double x) {
double tmp;
if (x <= 1.32e+154) {
tmp = 0.3333333333333333 * cbrt((1.0 / pow(x, 2.0)));
} else {
tmp = 1.0 / (1.0 + (cbrt(x) * (1.0 + cbrt(x))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.32e+154) {
tmp = 0.3333333333333333 * Math.cbrt((1.0 / Math.pow(x, 2.0)));
} else {
tmp = 1.0 / (1.0 + (Math.cbrt(x) * (1.0 + Math.cbrt(x))));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.32e+154) tmp = Float64(0.3333333333333333 * cbrt(Float64(1.0 / (x ^ 2.0)))); else tmp = Float64(1.0 / Float64(1.0 + Float64(cbrt(x) * Float64(1.0 + cbrt(x))))); end return tmp end
code[x_] := If[LessEqual[x, 1.32e+154], N[(0.3333333333333333 * N[Power[N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(1.0 + N[(N[Power[x, 1/3], $MachinePrecision] * N[(1.0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt[3]{\frac{1}{{x}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + \sqrt[3]{x} \cdot \left(1 + \sqrt[3]{x}\right)}\\
\end{array}
\end{array}
if x < 1.31999999999999998e154Initial program 11.6%
Taylor expanded in x around inf 93.2%
if 1.31999999999999998e154 < x Initial program 4.7%
flip3--4.7%
div-inv4.7%
rem-cube-cbrt3.1%
rem-cube-cbrt4.7%
+-commutative4.7%
distribute-rgt-out4.7%
+-commutative4.7%
fma-define4.7%
add-exp-log4.7%
Applied egg-rr4.7%
associate-*r/4.7%
*-rgt-identity4.7%
+-commutative4.7%
associate--l+92.1%
+-inverses92.1%
metadata-eval92.1%
+-commutative92.1%
exp-prod91.2%
Simplified91.2%
Taylor expanded in x around 0 17.7%
Final simplification55.8%
(FPCore (x) :precision binary64 (if (<= x 3.3e+15) (- (cbrt (+ 1.0 x)) (cbrt x)) (cbrt (/ 1.0 (pow x 2.0)))))
double code(double x) {
double tmp;
if (x <= 3.3e+15) {
tmp = cbrt((1.0 + x)) - cbrt(x);
} else {
tmp = cbrt((1.0 / pow(x, 2.0)));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 3.3e+15) {
tmp = Math.cbrt((1.0 + x)) - Math.cbrt(x);
} else {
tmp = Math.cbrt((1.0 / Math.pow(x, 2.0)));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 3.3e+15) tmp = Float64(cbrt(Float64(1.0 + x)) - cbrt(x)); else tmp = cbrt(Float64(1.0 / (x ^ 2.0))); end return tmp end
code[x_] := If[LessEqual[x, 3.3e+15], N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], N[Power[N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.3 \cdot 10^{+15}:\\
\;\;\;\;\sqrt[3]{1 + x} - \sqrt[3]{x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{1}{{x}^{2}}}\\
\end{array}
\end{array}
if x < 3.3e15Initial program 57.7%
if 3.3e15 < x Initial program 4.2%
flip3--4.2%
div-inv4.2%
rem-cube-cbrt3.5%
rem-cube-cbrt4.2%
+-commutative4.2%
distribute-rgt-out4.2%
+-commutative4.2%
fma-define4.2%
add-exp-log4.2%
Applied egg-rr4.2%
associate-*r/4.2%
*-rgt-identity4.2%
+-commutative4.2%
associate--l+93.1%
+-inverses93.1%
metadata-eval93.1%
+-commutative93.1%
exp-prod92.1%
Simplified92.1%
Taylor expanded in x around 0 17.7%
Taylor expanded in x around inf 10.7%
Final simplification14.2%
(FPCore (x) :precision binary64 (* 0.3333333333333333 (cbrt (/ 1.0 (pow x 2.0)))))
double code(double x) {
return 0.3333333333333333 * cbrt((1.0 / pow(x, 2.0)));
}
public static double code(double x) {
return 0.3333333333333333 * Math.cbrt((1.0 / Math.pow(x, 2.0)));
}
function code(x) return Float64(0.3333333333333333 * cbrt(Float64(1.0 / (x ^ 2.0)))) end
code[x_] := N[(0.3333333333333333 * N[Power[N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.3333333333333333 \cdot \sqrt[3]{\frac{1}{{x}^{2}}}
\end{array}
Initial program 8.2%
Taylor expanded in x around inf 49.3%
Final simplification49.3%
(FPCore (x) :precision binary64 (cbrt (/ 1.0 (pow x 2.0))))
double code(double x) {
return cbrt((1.0 / pow(x, 2.0)));
}
public static double code(double x) {
return Math.cbrt((1.0 / Math.pow(x, 2.0)));
}
function code(x) return cbrt(Float64(1.0 / (x ^ 2.0))) end
code[x_] := N[Power[N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{1}{{x}^{2}}}
\end{array}
Initial program 8.2%
flip3--8.4%
div-inv8.4%
rem-cube-cbrt8.6%
rem-cube-cbrt11.2%
+-commutative11.2%
distribute-rgt-out11.2%
+-commutative11.2%
fma-define11.2%
add-exp-log11.2%
Applied egg-rr11.1%
associate-*r/11.1%
*-rgt-identity11.1%
+-commutative11.1%
associate--l+93.4%
+-inverses93.4%
metadata-eval93.4%
+-commutative93.4%
exp-prod92.5%
Simplified92.5%
Taylor expanded in x around 0 17.7%
Taylor expanded in x around inf 11.3%
Final simplification11.3%
(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 8.2%
Taylor expanded in x around 0 1.8%
sub-neg1.8%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt5.5%
fabs-neg5.5%
unpow1/35.5%
metadata-eval5.5%
pow-sqr5.5%
fabs-sqr5.5%
pow-sqr5.5%
metadata-eval5.5%
unpow1/35.5%
Simplified5.5%
Final simplification5.5%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ x 1.0)))) (/ 1.0 (+ (+ (* t_0 t_0) (* (cbrt x) t_0)) (* (cbrt x) (cbrt x))))))
double code(double x) {
double t_0 = cbrt((x + 1.0));
return 1.0 / (((t_0 * t_0) + (cbrt(x) * t_0)) + (cbrt(x) * cbrt(x)));
}
public static double code(double x) {
double t_0 = Math.cbrt((x + 1.0));
return 1.0 / (((t_0 * t_0) + (Math.cbrt(x) * t_0)) + (Math.cbrt(x) * Math.cbrt(x)));
}
function code(x) t_0 = cbrt(Float64(x + 1.0)) return Float64(1.0 / Float64(Float64(Float64(t_0 * t_0) + Float64(cbrt(x) * t_0)) + Float64(cbrt(x) * cbrt(x)))) end
code[x_] := Block[{t$95$0 = N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision]}, N[(1.0 / N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{x + 1}\\
\frac{1}{\left(t\_0 \cdot t\_0 + \sqrt[3]{x} \cdot t\_0\right) + \sqrt[3]{x} \cdot \sqrt[3]{x}}
\end{array}
\end{array}
herbie shell --seed 2024076
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
:pre (and (> x 1.0) (< x 1e+308))
:alt
(/ 1.0 (+ (+ (* (cbrt (+ x 1.0)) (cbrt (+ x 1.0))) (* (cbrt x) (cbrt (+ x 1.0)))) (* (cbrt x) (cbrt x))))
(- (cbrt (+ x 1.0)) (cbrt x)))