
(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))) (t_1 (cbrt (sqrt (+ 1.0 x))))) (/ 1.0 (fma (cbrt x) (+ (cbrt x) t_0) (* (* t_1 t_1) t_0)))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double t_1 = cbrt(sqrt((1.0 + x)));
return 1.0 / fma(cbrt(x), (cbrt(x) + t_0), ((t_1 * t_1) * t_0));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) t_1 = cbrt(sqrt(Float64(1.0 + x))) return Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), Float64(Float64(t_1 * t_1) * t_0))) end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$1 = 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] + t$95$0), $MachinePrecision] + N[(N[(t$95$1 * t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
t_1 := \sqrt[3]{\sqrt{1 + x}}\\
\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, \left(t_1 \cdot t_1\right) \cdot t_0\right)}
\end{array}
\end{array}
Initial program 6.6%
flip3--6.9%
div-inv6.9%
rem-cube-cbrt6.2%
rem-cube-cbrt9.1%
+-commutative9.1%
distribute-rgt-out9.1%
+-commutative9.1%
fma-def9.1%
add-exp-log9.1%
Applied egg-rr9.0%
associate-*r/9.0%
*-rgt-identity9.0%
+-commutative9.0%
associate--l+93.0%
+-inverses93.0%
metadata-eval93.0%
+-commutative93.0%
exp-prod92.2%
Simplified92.2%
metadata-eval92.2%
prod-exp92.2%
pow-prod-down93.9%
pow293.9%
pow-exp93.0%
log1p-udef93.0%
log-pow93.5%
add-exp-log92.9%
pow1/398.5%
+-commutative98.5%
pow298.5%
Applied egg-rr98.5%
pow1/394.4%
add-sqr-sqrt94.4%
unpow-prod-down94.4%
pow-prod-up94.4%
metadata-eval94.4%
Applied egg-rr94.4%
metadata-eval94.4%
pow-sqr94.4%
unpow1/395.8%
+-commutative95.8%
unpow1/398.6%
+-commutative98.6%
Simplified98.6%
Final simplification98.6%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (cbrt (sqrt x)))) (/ 1.0 (fma (cbrt x) (+ t_0 (* t_1 t_1)) (pow t_0 2.0)))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double t_1 = cbrt(sqrt(x));
return 1.0 / fma(cbrt(x), (t_0 + (t_1 * t_1)), pow(t_0, 2.0));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) t_1 = cbrt(sqrt(x)) return Float64(1.0 / fma(cbrt(x), Float64(t_0 + Float64(t_1 * t_1)), (t_0 ^ 2.0))) end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Sqrt[x], $MachinePrecision], 1/3], $MachinePrecision]}, N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(t$95$0 + N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
t_1 := \sqrt[3]{\sqrt{x}}\\
\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_0 + t_1 \cdot t_1, {t_0}^{2}\right)}
\end{array}
\end{array}
Initial program 6.6%
flip3--6.9%
div-inv6.9%
rem-cube-cbrt6.2%
rem-cube-cbrt9.1%
+-commutative9.1%
distribute-rgt-out9.1%
+-commutative9.1%
fma-def9.1%
add-exp-log9.1%
Applied egg-rr9.0%
associate-*r/9.0%
*-rgt-identity9.0%
+-commutative9.0%
associate--l+93.0%
+-inverses93.0%
metadata-eval93.0%
+-commutative93.0%
exp-prod92.2%
Simplified92.2%
metadata-eval92.2%
prod-exp92.2%
pow-prod-down93.9%
pow293.9%
pow-exp93.0%
log1p-udef93.0%
log-pow93.5%
add-exp-log92.9%
pow1/398.5%
+-commutative98.5%
pow298.5%
Applied egg-rr98.5%
pow1/394.4%
add-sqr-sqrt94.4%
unpow-prod-down94.4%
pow-prod-up94.4%
metadata-eval94.4%
Applied egg-rr94.4%
*-rgt-identity94.4%
metadata-eval94.4%
pow-sqr94.4%
unpow1/395.8%
*-rgt-identity95.8%
unpow1/398.5%
*-rgt-identity98.5%
Simplified98.5%
pow298.5%
Applied egg-rr98.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 6.6%
flip3--6.9%
div-inv6.9%
rem-cube-cbrt6.2%
rem-cube-cbrt9.1%
+-commutative9.1%
distribute-rgt-out9.1%
+-commutative9.1%
fma-def9.1%
add-exp-log9.1%
Applied egg-rr9.0%
associate-*r/9.0%
*-rgt-identity9.0%
+-commutative9.0%
associate--l+93.0%
+-inverses93.0%
metadata-eval93.0%
+-commutative93.0%
exp-prod92.2%
Simplified92.2%
metadata-eval92.2%
prod-exp92.2%
pow-prod-down93.9%
pow293.9%
pow-exp93.0%
log1p-udef93.0%
log-pow93.5%
add-exp-log92.9%
pow1/398.5%
+-commutative98.5%
pow298.5%
Applied egg-rr98.5%
pow298.5%
Applied egg-rr98.5%
Final simplification98.5%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x)))) (/ (+ 1.0 (- x x)) (+ (pow t_0 2.0) (* (cbrt x) (+ (cbrt x) t_0))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return (1.0 + (x - x)) / (pow(t_0, 2.0) + (cbrt(x) * (cbrt(x) + t_0)));
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
return (1.0 + (x - x)) / (Math.pow(t_0, 2.0) + (Math.cbrt(x) * (Math.cbrt(x) + t_0)));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(Float64(1.0 + Float64(x - x)) / Float64((t_0 ^ 2.0) + Float64(cbrt(x) * Float64(cbrt(x) + t_0)))) end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\frac{1 + \left(x - x\right)}{{t_0}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + t_0\right)}
\end{array}
\end{array}
Initial program 6.6%
pow1/37.5%
Applied egg-rr7.5%
pow1/36.7%
Applied egg-rr6.7%
pow1/37.5%
flip3--7.4%
div-inv7.4%
+-commutative7.4%
rem-cube-cbrt7.5%
unpow1/36.2%
rem-cube-cbrt9.0%
pow29.0%
+-commutative9.0%
distribute-rgt-out9.0%
unpow1/39.1%
+-commutative9.1%
Applied egg-rr9.1%
associate-*r/9.1%
associate--l+98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x)
:precision binary64
(if (<= x 1.35e+154)
(+
(* 0.3333333333333333 (cbrt (/ 1.0 (pow x 2.0))))
(* (cbrt (/ 1.0 (pow x 5.0))) -0.1111111111111111))
(/
1.0
(fma
(cbrt x)
(+ (cbrt x) (cbrt (+ 1.0 x)))
(pow (+ 1.0 x) 0.6666666666666666)))))
double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = (0.3333333333333333 * cbrt((1.0 / pow(x, 2.0)))) + (cbrt((1.0 / pow(x, 5.0))) * -0.1111111111111111);
} else {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + cbrt((1.0 + x))), pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.35e+154) tmp = Float64(Float64(0.3333333333333333 * cbrt(Float64(1.0 / (x ^ 2.0)))) + Float64(cbrt(Float64(1.0 / (x ^ 5.0))) * -0.1111111111111111)); else tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(Float64(1.0 + x))), (Float64(1.0 + x) ^ 0.6666666666666666))); end return tmp end
code[x_] := If[LessEqual[x, 1.35e+154], N[(N[(0.3333333333333333 * N[Power[N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[(1.0 / N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * -0.1111111111111111), $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[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}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt[3]{\frac{1}{{x}^{2}}} + \sqrt[3]{\frac{1}{{x}^{5}}} \cdot -0.1111111111111111\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, {\left(1 + x\right)}^{0.6666666666666666}\right)}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 8.7%
add-sqr-sqrt8.8%
add-sqr-sqrt8.6%
difference-of-squares8.6%
pow1/38.6%
sqrt-pow18.6%
metadata-eval8.6%
pow1/38.6%
sqrt-pow18.6%
metadata-eval8.6%
pow1/36.5%
sqrt-pow16.5%
metadata-eval6.5%
pow1/39.0%
sqrt-pow18.8%
metadata-eval8.8%
Applied egg-rr8.8%
Taylor expanded in x around inf 91.0%
associate-+r+91.0%
+-commutative91.0%
unpow1/397.6%
distribute-rgt-out97.6%
unpow1/397.6%
metadata-eval97.6%
Simplified97.6%
if 1.35000000000000003e154 < 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-def4.7%
add-exp-log4.7%
Applied egg-rr4.7%
associate-*r/4.7%
*-rgt-identity4.7%
+-commutative4.7%
associate--l+91.6%
+-inverses91.6%
metadata-eval91.6%
+-commutative91.6%
exp-prod90.7%
Simplified90.7%
metadata-eval90.7%
prod-exp90.7%
pow-prod-down92.6%
pow292.6%
pow-exp91.6%
log1p-udef91.6%
log-pow92.2%
add-exp-log91.6%
pow1/398.5%
+-commutative98.5%
pow298.5%
Applied egg-rr98.5%
pow1/393.1%
pow1/391.6%
pow-prod-up91.6%
metadata-eval91.6%
Applied egg-rr91.6%
Final simplification94.4%
(FPCore (x)
:precision binary64
(if (<= x 1.35e+154)
(+
(* 0.3333333333333333 (cbrt (/ 1.0 (pow x 2.0))))
(* (cbrt (/ 1.0 (pow x 5.0))) -0.1111111111111111))
(/ 1.0 (fma (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x))) 1.0))))
double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = (0.3333333333333333 * cbrt((1.0 / pow(x, 2.0)))) + (cbrt((1.0 / pow(x, 5.0))) * -0.1111111111111111);
} 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.35e+154) tmp = Float64(Float64(0.3333333333333333 * cbrt(Float64(1.0 / (x ^ 2.0)))) + Float64(cbrt(Float64(1.0 / (x ^ 5.0))) * -0.1111111111111111)); 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.35e+154], N[(N[(0.3333333333333333 * N[Power[N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[(1.0 / N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * -0.1111111111111111), $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.35 \cdot 10^{+154}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt[3]{\frac{1}{{x}^{2}}} + \sqrt[3]{\frac{1}{{x}^{5}}} \cdot -0.1111111111111111\\
\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.35000000000000003e154Initial program 8.7%
add-sqr-sqrt8.8%
add-sqr-sqrt8.6%
difference-of-squares8.6%
pow1/38.6%
sqrt-pow18.6%
metadata-eval8.6%
pow1/38.6%
sqrt-pow18.6%
metadata-eval8.6%
pow1/36.5%
sqrt-pow16.5%
metadata-eval6.5%
pow1/39.0%
sqrt-pow18.8%
metadata-eval8.8%
Applied egg-rr8.8%
Taylor expanded in x around inf 91.0%
associate-+r+91.0%
+-commutative91.0%
unpow1/397.6%
distribute-rgt-out97.6%
unpow1/397.6%
metadata-eval97.6%
Simplified97.6%
if 1.35000000000000003e154 < 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-def4.7%
add-exp-log4.7%
Applied egg-rr4.7%
associate-*r/4.7%
*-rgt-identity4.7%
+-commutative4.7%
associate--l+91.6%
+-inverses91.6%
metadata-eval91.6%
+-commutative91.6%
exp-prod90.7%
Simplified90.7%
Taylor expanded in x around 0 20.0%
Final simplification57.2%
(FPCore (x) :precision binary64 (if (<= x 1.35e+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.35e+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.35e+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.35e+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.35 \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.35000000000000003e154Initial program 8.7%
add-sqr-sqrt8.8%
add-sqr-sqrt8.6%
difference-of-squares8.6%
pow1/38.6%
sqrt-pow18.6%
metadata-eval8.6%
pow1/38.6%
sqrt-pow18.6%
metadata-eval8.6%
pow1/36.5%
sqrt-pow16.5%
metadata-eval6.5%
pow1/39.0%
sqrt-pow18.8%
metadata-eval8.8%
Applied egg-rr8.8%
Taylor expanded in x around inf 89.0%
unpow1/395.3%
Simplified95.3%
if 1.35000000000000003e154 < 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-def4.7%
add-exp-log4.7%
Applied egg-rr4.7%
associate-*r/4.7%
*-rgt-identity4.7%
+-commutative4.7%
associate--l+91.6%
+-inverses91.6%
metadata-eval91.6%
+-commutative91.6%
exp-prod90.7%
Simplified90.7%
Taylor expanded in x around 0 20.0%
Final simplification56.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 6.6%
add-sqr-sqrt6.2%
add-sqr-sqrt6.6%
difference-of-squares6.6%
pow1/36.6%
sqrt-pow16.6%
metadata-eval6.6%
pow1/36.6%
sqrt-pow16.6%
metadata-eval6.6%
pow1/34.1%
sqrt-pow14.1%
metadata-eval4.1%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
Applied egg-rr6.7%
Taylor expanded in x around inf 45.2%
unpow1/348.3%
Simplified48.3%
Final simplification48.3%
(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 6.6%
Final simplification6.6%
(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 6.6%
Taylor expanded in x around inf 4.2%
Final simplification4.2%
(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 6.6%
Taylor expanded in x around 0 6.1%
Final simplification6.1%
(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 2024024
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
:pre (and (> x 1.0) (< x 1e+308))
:herbie-target
(/ 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)))