
(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 5.4%
flip3--5.4%
div-inv5.4%
rem-cube-cbrt4.7%
rem-cube-cbrt6.4%
+-commutative6.4%
distribute-rgt-out6.4%
+-commutative6.4%
fma-define6.4%
add-exp-log6.4%
Applied egg-rr6.4%
associate-*r/6.4%
*-rgt-identity6.4%
+-commutative6.4%
associate--l+93.4%
+-inverses93.4%
metadata-eval93.4%
+-commutative93.4%
exp-prod92.3%
Simplified92.3%
add-exp-log92.6%
log-pow93.4%
rem-log-exp93.4%
Applied egg-rr93.4%
log1p-undefine93.4%
pow-to-exp92.9%
add-sqr-sqrt92.9%
unpow-prod-down92.9%
+-commutative92.9%
+-commutative92.9%
Applied egg-rr92.9%
metadata-eval92.9%
pow-sqr92.9%
associate-*r*92.9%
metadata-eval92.9%
pow-sqr92.9%
unpow392.9%
unpow1/395.8%
rem-cube-cbrt95.8%
+-commutative95.8%
unpow1/398.8%
+-commutative98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x) :precision binary64 (/ 1.0 (fma (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x))) (* x (cbrt (+ (/ 1.0 x) (/ 2.0 (pow x 2.0))))))))
double code(double x) {
return 1.0 / fma(cbrt(x), (cbrt(x) + cbrt((1.0 + x))), (x * cbrt(((1.0 / x) + (2.0 / pow(x, 2.0))))));
}
function code(x) return Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(Float64(1.0 + x))), Float64(x * cbrt(Float64(Float64(1.0 / x) + Float64(2.0 / (x ^ 2.0))))))) end
code[x_] := 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[(x * N[Power[N[(N[(1.0 / x), $MachinePrecision] + N[(2.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, x \cdot \sqrt[3]{\frac{1}{x} + \frac{2}{{x}^{2}}}\right)}
\end{array}
Initial program 5.4%
flip3--5.4%
div-inv5.4%
rem-cube-cbrt4.7%
rem-cube-cbrt6.4%
+-commutative6.4%
distribute-rgt-out6.4%
+-commutative6.4%
fma-define6.4%
add-exp-log6.4%
Applied egg-rr6.4%
associate-*r/6.4%
*-rgt-identity6.4%
+-commutative6.4%
associate--l+93.4%
+-inverses93.4%
metadata-eval93.4%
+-commutative93.4%
exp-prod92.3%
Simplified92.3%
add-sqr-sqrt92.3%
unpow-prod-down94.1%
Applied egg-rr94.1%
pow-sqr94.1%
Simplified94.1%
sqr-pow94.1%
pow294.1%
pow-to-exp93.4%
*-commutative93.4%
associate-/l*93.4%
metadata-eval93.4%
*-commutative93.4%
*-un-lft-identity93.4%
pow1/293.4%
log-pow93.4%
rem-log-exp93.4%
metadata-eval93.4%
log1p-undefine93.4%
log-pow93.6%
pow1/394.2%
add-exp-log98.5%
pow298.5%
Applied egg-rr98.5%
Taylor expanded in x around inf 98.6%
associate-*r/98.6%
metadata-eval98.6%
Simplified98.6%
Final simplification98.6%
(FPCore (x)
:precision binary64
(if (<= x 1.35e+154)
(/
1.0
(fma (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x))) (cbrt (pow (+ 1.0 x) 2.0))))
(/
1.0
(fma
(cbrt x)
(+ (cbrt x) (cbrt x))
(exp (* (log1p x) 0.6666666666666666))))))
double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + cbrt((1.0 + x))), cbrt(pow((1.0 + x), 2.0)));
} else {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + cbrt(x)), exp((log1p(x) * 0.6666666666666666)));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.35e+154) tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(Float64(1.0 + x))), cbrt((Float64(1.0 + x) ^ 2.0)))); else tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(x)), exp(Float64(log1p(x) * 0.6666666666666666)))); end return tmp end
code[x_] := If[LessEqual[x, 1.35e+154], 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[Power[N[(1.0 + x), $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision] + N[Exp[N[(N[Log[1 + x], $MachinePrecision] * 0.6666666666666666), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, \sqrt[3]{{\left(1 + x\right)}^{2}}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{x}, e^{\mathsf{log1p}\left(x\right) \cdot 0.6666666666666666}\right)}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 6.0%
flip3--6.2%
div-inv6.2%
rem-cube-cbrt6.4%
rem-cube-cbrt8.1%
+-commutative8.1%
distribute-rgt-out8.1%
+-commutative8.1%
fma-define8.1%
add-exp-log8.1%
Applied egg-rr8.1%
associate-*r/8.1%
*-rgt-identity8.1%
+-commutative8.1%
associate--l+94.5%
+-inverses94.5%
metadata-eval94.5%
+-commutative94.5%
exp-prod93.8%
Simplified93.8%
add-sqr-sqrt93.8%
unpow-prod-down95.2%
Applied egg-rr95.2%
pow-sqr95.2%
Simplified95.2%
sqr-pow95.2%
pow295.2%
pow-to-exp94.5%
*-commutative94.5%
associate-/l*94.5%
metadata-eval94.5%
*-commutative94.5%
*-un-lft-identity94.5%
pow1/294.5%
log-pow94.5%
rem-log-exp94.5%
metadata-eval94.5%
log1p-undefine94.5%
log-pow94.8%
pow1/395.2%
add-exp-log98.5%
pow298.5%
cbrt-unprod98.7%
Applied egg-rr98.7%
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-define4.7%
add-exp-log4.7%
Applied egg-rr4.7%
associate-*r/4.7%
*-rgt-identity4.7%
+-commutative4.7%
associate--l+92.4%
+-inverses92.4%
metadata-eval92.4%
+-commutative92.4%
exp-prod90.9%
Simplified90.9%
add-exp-log91.4%
log-pow92.4%
rem-log-exp92.4%
Applied egg-rr92.4%
Taylor expanded in x around inf 92.4%
Final simplification95.5%
(FPCore (x)
:precision binary64
(if (<= x 1.35e+154)
(/ 1.0 (fma (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x))) (cbrt (pow x 2.0))))
(/
1.0
(fma
(cbrt x)
(+ (cbrt x) (cbrt x))
(exp (* (log1p x) 0.6666666666666666))))))
double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + cbrt((1.0 + x))), cbrt(pow(x, 2.0)));
} else {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + cbrt(x)), exp((log1p(x) * 0.6666666666666666)));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.35e+154) tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(Float64(1.0 + x))), cbrt((x ^ 2.0)))); else tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(x)), exp(Float64(log1p(x) * 0.6666666666666666)))); end return tmp end
code[x_] := If[LessEqual[x, 1.35e+154], 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[Power[x, 2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision] + N[Exp[N[(N[Log[1 + x], $MachinePrecision] * 0.6666666666666666), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, \sqrt[3]{{x}^{2}}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{x}, e^{\mathsf{log1p}\left(x\right) \cdot 0.6666666666666666}\right)}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 6.0%
flip3--6.2%
div-inv6.2%
rem-cube-cbrt6.4%
rem-cube-cbrt8.1%
+-commutative8.1%
distribute-rgt-out8.1%
+-commutative8.1%
fma-define8.1%
add-exp-log8.1%
Applied egg-rr8.1%
associate-*r/8.1%
*-rgt-identity8.1%
+-commutative8.1%
associate--l+94.5%
+-inverses94.5%
metadata-eval94.5%
+-commutative94.5%
exp-prod93.8%
Simplified93.8%
Taylor expanded in x around inf 97.2%
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-define4.7%
add-exp-log4.7%
Applied egg-rr4.7%
associate-*r/4.7%
*-rgt-identity4.7%
+-commutative4.7%
associate--l+92.4%
+-inverses92.4%
metadata-eval92.4%
+-commutative92.4%
exp-prod90.9%
Simplified90.9%
add-exp-log91.4%
log-pow92.4%
rem-log-exp92.4%
Applied egg-rr92.4%
Taylor expanded in x around inf 92.4%
Final simplification94.7%
(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 x))
(exp (* (log1p x) 0.6666666666666666))))))
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(x)), exp((log1p(x) * 0.6666666666666666)));
}
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(x)), exp(Float64(log1p(x) * 0.6666666666666666)))); 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[x, 1/3], $MachinePrecision]), $MachinePrecision] + N[Exp[N[(N[Log[1 + x], $MachinePrecision] * 0.6666666666666666), $MachinePrecision]], $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}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{x}, e^{\mathsf{log1p}\left(x\right) \cdot 0.6666666666666666}\right)}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 6.0%
Taylor expanded in x around inf 97.2%
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-define4.7%
add-exp-log4.7%
Applied egg-rr4.7%
associate-*r/4.7%
*-rgt-identity4.7%
+-commutative4.7%
associate--l+92.4%
+-inverses92.4%
metadata-eval92.4%
+-commutative92.4%
exp-prod90.9%
Simplified90.9%
add-exp-log91.4%
log-pow92.4%
rem-log-exp92.4%
Applied egg-rr92.4%
Taylor expanded in x around inf 92.4%
Final simplification94.7%
(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 5.4%
flip3--5.4%
div-inv5.4%
rem-cube-cbrt4.7%
rem-cube-cbrt6.4%
+-commutative6.4%
distribute-rgt-out6.4%
+-commutative6.4%
fma-define6.4%
add-exp-log6.4%
Applied egg-rr6.4%
associate-*r/6.4%
*-rgt-identity6.4%
+-commutative6.4%
associate--l+93.4%
+-inverses93.4%
metadata-eval93.4%
+-commutative93.4%
exp-prod92.3%
Simplified92.3%
add-sqr-sqrt92.3%
unpow-prod-down94.1%
Applied egg-rr94.1%
pow-sqr94.1%
Simplified94.1%
sqr-pow94.1%
pow294.1%
pow-to-exp93.4%
*-commutative93.4%
associate-/l*93.4%
metadata-eval93.4%
*-commutative93.4%
*-un-lft-identity93.4%
pow1/293.4%
log-pow93.4%
rem-log-exp93.4%
metadata-eval93.4%
log1p-undefine93.4%
log-pow93.6%
pow1/394.2%
add-exp-log98.5%
pow298.5%
Applied egg-rr98.5%
pow298.5%
Applied egg-rr98.5%
Final simplification98.5%
(FPCore (x) :precision binary64 (/ 1.0 (fma (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x))) (exp (* (log1p x) 0.6666666666666666)))))
double code(double x) {
return 1.0 / fma(cbrt(x), (cbrt(x) + cbrt((1.0 + x))), exp((log1p(x) * 0.6666666666666666)));
}
function code(x) return Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(Float64(1.0 + x))), exp(Float64(log1p(x) * 0.6666666666666666)))) end
code[x_] := 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[Exp[N[(N[Log[1 + x], $MachinePrecision] * 0.6666666666666666), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, e^{\mathsf{log1p}\left(x\right) \cdot 0.6666666666666666}\right)}
\end{array}
Initial program 5.4%
flip3--5.4%
div-inv5.4%
rem-cube-cbrt4.7%
rem-cube-cbrt6.4%
+-commutative6.4%
distribute-rgt-out6.4%
+-commutative6.4%
fma-define6.4%
add-exp-log6.4%
Applied egg-rr6.4%
associate-*r/6.4%
*-rgt-identity6.4%
+-commutative6.4%
associate--l+93.4%
+-inverses93.4%
metadata-eval93.4%
+-commutative93.4%
exp-prod92.3%
Simplified92.3%
add-exp-log92.6%
log-pow93.4%
rem-log-exp93.4%
Applied egg-rr93.4%
Final simplification93.4%
(FPCore (x) :precision binary64 (/ 1.0 (fma (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x))) (pow (+ 1.0 x) 0.6666666666666666))))
double code(double x) {
return 1.0 / fma(cbrt(x), (cbrt(x) + cbrt((1.0 + x))), pow((1.0 + x), 0.6666666666666666));
}
function code(x) return Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(Float64(1.0 + x))), (Float64(1.0 + x) ^ 0.6666666666666666))) end
code[x_] := 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}
\\
\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, {\left(1 + x\right)}^{0.6666666666666666}\right)}
\end{array}
Initial program 5.4%
flip3--5.4%
div-inv5.4%
rem-cube-cbrt4.7%
rem-cube-cbrt6.4%
+-commutative6.4%
distribute-rgt-out6.4%
+-commutative6.4%
fma-define6.4%
add-exp-log6.4%
Applied egg-rr6.4%
associate-*r/6.4%
*-rgt-identity6.4%
+-commutative6.4%
associate--l+93.4%
+-inverses93.4%
metadata-eval93.4%
+-commutative93.4%
exp-prod92.3%
Simplified92.3%
add-sqr-sqrt92.3%
unpow-prod-down94.1%
Applied egg-rr94.1%
pow-sqr94.1%
Simplified94.1%
sqr-pow94.1%
pow294.1%
pow-to-exp93.4%
*-commutative93.4%
associate-/l*93.4%
metadata-eval93.4%
*-commutative93.4%
*-un-lft-identity93.4%
pow1/293.4%
log-pow93.4%
rem-log-exp93.4%
metadata-eval93.4%
log1p-undefine93.4%
log-pow93.6%
pow1/394.2%
add-exp-log98.5%
pow298.5%
Applied egg-rr98.5%
pow298.5%
pow1/392.9%
+-commutative92.9%
pow-pow92.9%
metadata-eval92.9%
+-commutative92.9%
Applied egg-rr92.9%
Final simplification92.9%
(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 6.0%
Taylor expanded in x around inf 97.2%
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-define4.7%
add-exp-log4.7%
Applied egg-rr4.7%
associate-*r/4.7%
*-rgt-identity4.7%
+-commutative4.7%
associate--l+92.4%
+-inverses92.4%
metadata-eval92.4%
+-commutative92.4%
exp-prod90.9%
Simplified90.9%
Taylor expanded in x around 0 20.0%
Final simplification58.0%
(FPCore (x) :precision binary64 (if (<= x 1.35e+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.35e+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.35e+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.35e+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.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[(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.35 \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.35000000000000003e154Initial program 6.0%
Taylor expanded in x around inf 97.2%
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-define4.7%
add-exp-log4.7%
Applied egg-rr4.7%
associate-*r/4.7%
*-rgt-identity4.7%
+-commutative4.7%
associate--l+92.4%
+-inverses92.4%
metadata-eval92.4%
+-commutative92.4%
exp-prod90.9%
Simplified90.9%
add-exp-log91.4%
log-pow92.4%
rem-log-exp92.4%
Applied egg-rr92.4%
Taylor expanded in x around 0 17.7%
Final simplification56.8%
(FPCore (x) :precision binary64 (+ (cbrt x) (- 0.0 (pow x 0.3333333333333333))))
double code(double x) {
return cbrt(x) + (0.0 - pow(x, 0.3333333333333333));
}
public static double code(double x) {
return Math.cbrt(x) + (0.0 - Math.pow(x, 0.3333333333333333));
}
function code(x) return Float64(cbrt(x) + Float64(0.0 - (x ^ 0.3333333333333333))) end
code[x_] := N[(N[Power[x, 1/3], $MachinePrecision] + N[(0.0 - N[Power[x, 0.3333333333333333], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{x} + \left(0 - {x}^{0.3333333333333333}\right)
\end{array}
Initial program 5.4%
Taylor expanded in x around inf 4.2%
pow1/35.6%
Applied egg-rr5.6%
Final simplification5.6%
(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 5.4%
Taylor expanded in x around inf 50.2%
Final simplification50.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 5.4%
Taylor expanded in x around 0 1.8%
sub-neg1.8%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt5.2%
fabs-neg5.2%
unpow1/35.2%
metadata-eval5.2%
pow-sqr5.2%
fabs-sqr5.2%
pow-sqr5.2%
metadata-eval5.2%
unpow1/35.2%
Simplified5.2%
Final simplification5.2%
(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 2024078
(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)))