
(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 (sqrt (+ 1.0 x)))) (/ 1.0 (fma (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x))) (* t_0 (cbrt t_0))))))
double code(double x) {
double t_0 = sqrt((1.0 + x));
return 1.0 / fma(cbrt(x), (cbrt(x) + cbrt((1.0 + x))), (t_0 * cbrt(t_0)));
}
function code(x) t_0 = sqrt(Float64(1.0 + x)) return Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(Float64(1.0 + x))), Float64(t_0 * cbrt(t_0)))) end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(1.0 + x), $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] + N[(t$95$0 * N[Power[t$95$0, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{1 + x}\\
\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, t\_0 \cdot \sqrt[3]{t\_0}\right)}
\end{array}
\end{array}
Initial program 6.7%
flip3--6.7%
rem-cube-cbrt6.0%
rem-cube-cbrt7.5%
div-sub6.8%
Applied egg-rr6.8%
div-sub7.5%
+-commutative7.5%
associate--l+93.2%
+-inverses93.2%
metadata-eval93.2%
+-commutative93.2%
+-commutative93.2%
log1p-undefine93.2%
+-commutative93.2%
exp-to-pow92.9%
+-commutative92.9%
Simplified92.9%
add-sqr-sqrt92.9%
pow292.9%
sqrt-pow192.9%
metadata-eval92.9%
pow1/398.6%
Applied egg-rr98.6%
unpow298.6%
add-sqr-sqrt98.5%
associate-*r*98.5%
pow198.5%
metadata-eval98.5%
sqrt-pow198.5%
sqrt-prod98.5%
unpow298.5%
add-cube-cbrt98.8%
add-sqr-sqrt98.8%
hypot-1-def98.8%
add-cbrt-cube98.8%
sqrt-prod98.8%
unpow298.8%
sqrt-prod98.8%
Applied egg-rr98.9%
hypot-undefine98.9%
metadata-eval98.9%
rem-square-sqrt98.9%
hypot-undefine98.9%
metadata-eval98.9%
rem-square-sqrt98.9%
Simplified98.9%
(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 6.7%
flip3--6.7%
rem-cube-cbrt6.0%
rem-cube-cbrt7.5%
div-sub6.8%
Applied egg-rr6.8%
div-sub7.5%
+-commutative7.5%
associate--l+93.2%
+-inverses93.2%
metadata-eval93.2%
+-commutative93.2%
+-commutative93.2%
log1p-undefine93.2%
+-commutative93.2%
exp-to-pow92.9%
+-commutative92.9%
Simplified92.9%
add-sqr-sqrt92.9%
pow292.9%
sqrt-pow192.9%
metadata-eval92.9%
pow1/398.6%
Applied egg-rr98.6%
(FPCore (x)
:precision binary64
(if (<= x 1.35e+154)
(* (cbrt (/ 1.0 (pow x 2.0))) 0.3333333333333333)
(/
1.0
(+
(* 2.0 (pow x 0.6666666666666666))
(exp (* 0.6666666666666666 (log1p x)))))))
double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = cbrt((1.0 / pow(x, 2.0))) * 0.3333333333333333;
} else {
tmp = 1.0 / ((2.0 * pow(x, 0.6666666666666666)) + exp((0.6666666666666666 * log1p(x))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = Math.cbrt((1.0 / Math.pow(x, 2.0))) * 0.3333333333333333;
} else {
tmp = 1.0 / ((2.0 * Math.pow(x, 0.6666666666666666)) + Math.exp((0.6666666666666666 * Math.log1p(x))));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.35e+154) tmp = Float64(cbrt(Float64(1.0 / (x ^ 2.0))) * 0.3333333333333333); else tmp = Float64(1.0 / Float64(Float64(2.0 * (x ^ 0.6666666666666666)) + exp(Float64(0.6666666666666666 * log1p(x))))); end return tmp end
code[x_] := If[LessEqual[x, 1.35e+154], N[(N[Power[N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(1.0 / N[(N[(2.0 * N[Power[x, 0.6666666666666666], $MachinePrecision]), $MachinePrecision] + N[Exp[N[(0.6666666666666666 * N[Log[1 + x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\sqrt[3]{\frac{1}{{x}^{2}}} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 \cdot {x}^{0.6666666666666666} + e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 8.5%
Taylor expanded in x around inf 94.9%
if 1.35000000000000003e154 < x Initial program 4.8%
flip3--4.8%
rem-cube-cbrt3.0%
rem-cube-cbrt4.8%
div-sub4.8%
Applied egg-rr4.8%
div-sub4.8%
+-commutative4.8%
associate--l+91.9%
+-inverses91.9%
metadata-eval91.9%
+-commutative91.9%
+-commutative91.9%
log1p-undefine91.9%
+-commutative91.9%
exp-to-pow91.6%
+-commutative91.6%
Simplified91.6%
Taylor expanded in x around inf 91.6%
fma-undefine91.6%
*-commutative91.6%
associate-*r*91.6%
pow1/390.0%
pow1/389.1%
pow-prod-up89.1%
metadata-eval89.1%
add-exp-log89.2%
log-pow89.5%
log1p-define89.5%
Applied egg-rr89.5%
Final simplification92.2%
(FPCore (x)
:precision binary64
(if (<= x 1.35e+154)
(* (cbrt (/ 1.0 (pow x 2.0))) 0.3333333333333333)
(/
1.0
(fma 2.0 (pow x 0.6666666666666666) (pow (+ 1.0 x) 0.6666666666666666)))))
double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = cbrt((1.0 / pow(x, 2.0))) * 0.3333333333333333;
} else {
tmp = 1.0 / fma(2.0, pow(x, 0.6666666666666666), pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.35e+154) tmp = Float64(cbrt(Float64(1.0 / (x ^ 2.0))) * 0.3333333333333333); else tmp = Float64(1.0 / fma(2.0, (x ^ 0.6666666666666666), (Float64(1.0 + x) ^ 0.6666666666666666))); end return tmp end
code[x_] := If[LessEqual[x, 1.35e+154], N[(N[Power[N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(1.0 / N[(2.0 * N[Power[x, 0.6666666666666666], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\sqrt[3]{\frac{1}{{x}^{2}}} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(2, {x}^{0.6666666666666666}, {\left(1 + x\right)}^{0.6666666666666666}\right)}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 8.5%
Taylor expanded in x around inf 94.9%
if 1.35000000000000003e154 < x Initial program 4.8%
flip3--4.8%
rem-cube-cbrt3.0%
rem-cube-cbrt4.8%
div-sub4.8%
Applied egg-rr4.8%
div-sub4.8%
+-commutative4.8%
associate--l+91.9%
+-inverses91.9%
metadata-eval91.9%
+-commutative91.9%
+-commutative91.9%
log1p-undefine91.9%
+-commutative91.9%
exp-to-pow91.6%
+-commutative91.6%
Simplified91.6%
Taylor expanded in x around inf 91.6%
fma-undefine91.6%
metadata-eval91.6%
pow-pow91.6%
pow1/398.5%
+-commutative98.5%
pow1/391.6%
pow-pow91.6%
metadata-eval91.6%
add-exp-log92.1%
log-pow91.9%
log1p-define91.9%
*-commutative91.9%
associate-*r*91.9%
pow1/390.8%
pow1/389.5%
pow-prod-up89.5%
metadata-eval89.5%
Applied egg-rr89.5%
+-commutative89.5%
*-commutative89.5%
fma-define89.5%
*-commutative89.5%
log1p-undefine89.5%
exp-to-pow89.1%
Simplified89.1%
Final simplification92.0%
(FPCore (x) :precision binary64 (/ (+ (* (cbrt (/ 1.0 (pow x 2.0))) -0.1111111111111111) (* (cbrt x) 0.3333333333333333)) x))
double code(double x) {
return ((cbrt((1.0 / pow(x, 2.0))) * -0.1111111111111111) + (cbrt(x) * 0.3333333333333333)) / x;
}
public static double code(double x) {
return ((Math.cbrt((1.0 / Math.pow(x, 2.0))) * -0.1111111111111111) + (Math.cbrt(x) * 0.3333333333333333)) / x;
}
function code(x) return Float64(Float64(Float64(cbrt(Float64(1.0 / (x ^ 2.0))) * -0.1111111111111111) + Float64(cbrt(x) * 0.3333333333333333)) / x) end
code[x_] := N[(N[(N[(N[Power[N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * -0.1111111111111111), $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt[3]{\frac{1}{{x}^{2}}} \cdot -0.1111111111111111 + \sqrt[3]{x} \cdot 0.3333333333333333}{x}
\end{array}
Initial program 6.7%
add-sqr-sqrt6.4%
add-sqr-sqrt6.6%
difference-of-squares6.7%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
pow1/34.3%
sqrt-pow14.4%
metadata-eval4.4%
pow1/36.5%
sqrt-pow16.7%
metadata-eval6.7%
Applied egg-rr6.7%
Taylor expanded in x around inf 97.9%
associate-+r+97.9%
distribute-rgt-out97.9%
metadata-eval97.9%
Simplified97.9%
Final simplification97.9%
(FPCore (x) :precision binary64 (if (<= x 1.35e+154) (* (cbrt (/ 1.0 (pow x 2.0))) 0.3333333333333333) (/ (+ (* -0.25 (cbrt (/ 1.0 x))) (* (cbrt x) 0.5)) x)))
double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = cbrt((1.0 / pow(x, 2.0))) * 0.3333333333333333;
} else {
tmp = ((-0.25 * cbrt((1.0 / x))) + (cbrt(x) * 0.5)) / x;
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = Math.cbrt((1.0 / Math.pow(x, 2.0))) * 0.3333333333333333;
} else {
tmp = ((-0.25 * Math.cbrt((1.0 / x))) + (Math.cbrt(x) * 0.5)) / x;
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.35e+154) tmp = Float64(cbrt(Float64(1.0 / (x ^ 2.0))) * 0.3333333333333333); else tmp = Float64(Float64(Float64(-0.25 * cbrt(Float64(1.0 / x))) + Float64(cbrt(x) * 0.5)) / x); end return tmp end
code[x_] := If[LessEqual[x, 1.35e+154], N[(N[Power[N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(N[(N[(-0.25 * N[Power[N[(1.0 / x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\sqrt[3]{\frac{1}{{x}^{2}}} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.25 \cdot \sqrt[3]{\frac{1}{x}} + \sqrt[3]{x} \cdot 0.5}{x}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 8.5%
Taylor expanded in x around inf 94.9%
if 1.35000000000000003e154 < x Initial program 4.8%
flip3--4.8%
rem-cube-cbrt3.0%
rem-cube-cbrt4.8%
div-sub4.8%
Applied egg-rr4.8%
div-sub4.8%
+-commutative4.8%
associate--l+91.9%
+-inverses91.9%
metadata-eval91.9%
+-commutative91.9%
+-commutative91.9%
log1p-undefine91.9%
+-commutative91.9%
exp-to-pow91.6%
+-commutative91.6%
Simplified91.6%
Taylor expanded in x around inf 91.6%
Taylor expanded in x around 0 20.0%
Taylor expanded in x around inf 20.0%
Final simplification57.8%
(FPCore (x) :precision binary64 (if (<= x 1.35e+154) (* (cbrt (/ 1.0 (pow x 2.0))) 0.3333333333333333) (/ 1.0 (* x (+ (/ 1.0 x) (* 2.0 (cbrt (/ 1.0 x))))))))
double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = cbrt((1.0 / pow(x, 2.0))) * 0.3333333333333333;
} else {
tmp = 1.0 / (x * ((1.0 / x) + (2.0 * cbrt((1.0 / x)))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = Math.cbrt((1.0 / Math.pow(x, 2.0))) * 0.3333333333333333;
} else {
tmp = 1.0 / (x * ((1.0 / x) + (2.0 * Math.cbrt((1.0 / x)))));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.35e+154) tmp = Float64(cbrt(Float64(1.0 / (x ^ 2.0))) * 0.3333333333333333); else tmp = Float64(1.0 / Float64(x * Float64(Float64(1.0 / x) + Float64(2.0 * cbrt(Float64(1.0 / x)))))); end return tmp end
code[x_] := If[LessEqual[x, 1.35e+154], N[(N[Power[N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * 0.3333333333333333), $MachinePrecision], N[(1.0 / N[(x * N[(N[(1.0 / x), $MachinePrecision] + N[(2.0 * N[Power[N[(1.0 / x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\sqrt[3]{\frac{1}{{x}^{2}}} \cdot 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(\frac{1}{x} + 2 \cdot \sqrt[3]{\frac{1}{x}}\right)}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 8.5%
Taylor expanded in x around inf 94.9%
if 1.35000000000000003e154 < x Initial program 4.8%
flip3--4.8%
rem-cube-cbrt3.0%
rem-cube-cbrt4.8%
div-sub4.8%
Applied egg-rr4.8%
div-sub4.8%
+-commutative4.8%
associate--l+91.9%
+-inverses91.9%
metadata-eval91.9%
+-commutative91.9%
+-commutative91.9%
log1p-undefine91.9%
+-commutative91.9%
exp-to-pow91.6%
+-commutative91.6%
Simplified91.6%
Taylor expanded in x around inf 91.6%
Taylor expanded in x around 0 20.0%
Taylor expanded in x around inf 20.0%
Final simplification57.8%
(FPCore (x) :precision binary64 (if (<= x 2.2e+15) (- (cbrt (+ 1.0 x)) (cbrt x)) (/ 1.0 (* x (+ (/ 1.0 x) (* 2.0 (cbrt (/ 1.0 x))))))))
double code(double x) {
double tmp;
if (x <= 2.2e+15) {
tmp = cbrt((1.0 + x)) - cbrt(x);
} else {
tmp = 1.0 / (x * ((1.0 / x) + (2.0 * cbrt((1.0 / x)))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 2.2e+15) {
tmp = Math.cbrt((1.0 + x)) - Math.cbrt(x);
} else {
tmp = 1.0 / (x * ((1.0 / x) + (2.0 * Math.cbrt((1.0 / x)))));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 2.2e+15) tmp = Float64(cbrt(Float64(1.0 + x)) - cbrt(x)); else tmp = Float64(1.0 / Float64(x * Float64(Float64(1.0 / x) + Float64(2.0 * cbrt(Float64(1.0 / x)))))); end return tmp end
code[x_] := If[LessEqual[x, 2.2e+15], N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(x * N[(N[(1.0 / x), $MachinePrecision] + N[(2.0 * 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.2 \cdot 10^{+15}:\\
\;\;\;\;\sqrt[3]{1 + x} - \sqrt[3]{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(\frac{1}{x} + 2 \cdot \sqrt[3]{\frac{1}{x}}\right)}\\
\end{array}
\end{array}
if x < 2.2e15Initial program 74.4%
if 2.2e15 < x Initial program 4.2%
flip3--4.2%
rem-cube-cbrt3.5%
rem-cube-cbrt4.2%
div-sub4.2%
Applied egg-rr4.2%
div-sub4.2%
+-commutative4.2%
associate--l+93.0%
+-inverses93.0%
metadata-eval93.0%
+-commutative93.0%
+-commutative93.0%
log1p-undefine93.0%
+-commutative93.0%
exp-to-pow92.7%
+-commutative92.7%
Simplified92.7%
Taylor expanded in x around inf 92.7%
Taylor expanded in x around 0 20.0%
Taylor expanded in x around inf 20.0%
Final simplification21.9%
(FPCore (x) :precision binary64 (/ 1.0 (* x (+ (/ 1.0 x) (* 2.0 (cbrt (/ 1.0 x)))))))
double code(double x) {
return 1.0 / (x * ((1.0 / x) + (2.0 * cbrt((1.0 / x)))));
}
public static double code(double x) {
return 1.0 / (x * ((1.0 / x) + (2.0 * Math.cbrt((1.0 / x)))));
}
function code(x) return Float64(1.0 / Float64(x * Float64(Float64(1.0 / x) + Float64(2.0 * cbrt(Float64(1.0 / x)))))) end
code[x_] := N[(1.0 / N[(x * N[(N[(1.0 / x), $MachinePrecision] + N[(2.0 * N[Power[N[(1.0 / x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x \cdot \left(\frac{1}{x} + 2 \cdot \sqrt[3]{\frac{1}{x}}\right)}
\end{array}
Initial program 6.7%
flip3--6.7%
rem-cube-cbrt6.0%
rem-cube-cbrt7.5%
div-sub6.8%
Applied egg-rr6.8%
div-sub7.5%
+-commutative7.5%
associate--l+93.2%
+-inverses93.2%
metadata-eval93.2%
+-commutative93.2%
+-commutative93.2%
log1p-undefine93.2%
+-commutative93.2%
exp-to-pow92.9%
+-commutative92.9%
Simplified92.9%
Taylor expanded in x around inf 91.1%
Taylor expanded in x around 0 20.0%
Taylor expanded in x around inf 20.0%
Final simplification20.0%
(FPCore (x) :precision binary64 (/ 1.0 (+ 1.0 (* 2.0 (pow x 0.6666666666666666)))))
double code(double x) {
return 1.0 / (1.0 + (2.0 * pow(x, 0.6666666666666666)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 / (1.0d0 + (2.0d0 * (x ** 0.6666666666666666d0)))
end function
public static double code(double x) {
return 1.0 / (1.0 + (2.0 * Math.pow(x, 0.6666666666666666)));
}
def code(x): return 1.0 / (1.0 + (2.0 * math.pow(x, 0.6666666666666666)))
function code(x) return Float64(1.0 / Float64(1.0 + Float64(2.0 * (x ^ 0.6666666666666666)))) end
function tmp = code(x) tmp = 1.0 / (1.0 + (2.0 * (x ^ 0.6666666666666666))); end
code[x_] := N[(1.0 / N[(1.0 + N[(2.0 * N[Power[x, 0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{1 + 2 \cdot {x}^{0.6666666666666666}}
\end{array}
Initial program 6.7%
flip3--6.7%
rem-cube-cbrt6.0%
rem-cube-cbrt7.5%
div-sub6.8%
Applied egg-rr6.8%
div-sub7.5%
+-commutative7.5%
associate--l+93.2%
+-inverses93.2%
metadata-eval93.2%
+-commutative93.2%
+-commutative93.2%
log1p-undefine93.2%
+-commutative93.2%
exp-to-pow92.9%
+-commutative92.9%
Simplified92.9%
Taylor expanded in x around inf 91.1%
Taylor expanded in x around 0 20.0%
fma-undefine20.0%
*-commutative20.0%
associate-*r*20.0%
pow1/320.0%
pow1/320.0%
pow-prod-up20.0%
metadata-eval20.0%
Applied egg-rr20.0%
Final simplification20.0%
(FPCore (x) :precision binary64 (- (+ 1.0 (* x 0.3333333333333333)) (cbrt x)))
double code(double x) {
return (1.0 + (x * 0.3333333333333333)) - cbrt(x);
}
public static double code(double x) {
return (1.0 + (x * 0.3333333333333333)) - Math.cbrt(x);
}
function code(x) return Float64(Float64(1.0 + Float64(x * 0.3333333333333333)) - cbrt(x)) end
code[x_] := N[(N[(1.0 + N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + x \cdot 0.3333333333333333\right) - \sqrt[3]{x}
\end{array}
Initial program 6.7%
Taylor expanded in x around 0 4.2%
Final simplification4.2%
(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 6.7%
Taylor expanded in x around 0 1.8%
(FPCore (x) :precision binary64 (- (cbrt x)))
double code(double x) {
return -cbrt(x);
}
public static double code(double x) {
return -Math.cbrt(x);
}
function code(x) return Float64(-cbrt(x)) end
code[x_] := (-N[Power[x, 1/3], $MachinePrecision])
\begin{array}{l}
\\
-\sqrt[3]{x}
\end{array}
Initial program 6.7%
Taylor expanded in x around 0 1.8%
Taylor expanded in x around inf 1.8%
neg-mul-11.8%
Simplified1.8%
(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 2024095
(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)))