
(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 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (cbrt x)))
double code(double x) {
return cbrt((x + 1.0)) - cbrt(x);
}
public static double code(double x) {
return Math.cbrt((x + 1.0)) - Math.cbrt(x);
}
function code(x) return Float64(cbrt(Float64(x + 1.0)) - cbrt(x)) end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{x + 1} - \sqrt[3]{x}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(/
(+ 1.0 (- x x))
(fma
(cbrt x)
(/ (+ x (+ 1.0 x)) (+ (pow (cbrt x) 2.0) (* t_0 (- t_0 (cbrt x)))))
(pow t_0 2.0)))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return (1.0 + (x - x)) / fma(cbrt(x), ((x + (1.0 + x)) / (pow(cbrt(x), 2.0) + (t_0 * (t_0 - cbrt(x))))), pow(t_0, 2.0));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(Float64(1.0 + Float64(x - x)) / fma(cbrt(x), Float64(Float64(x + Float64(1.0 + x)) / Float64((cbrt(x) ^ 2.0) + Float64(t_0 * Float64(t_0 - cbrt(x))))), (t_0 ^ 2.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[x, 1/3], $MachinePrecision] * N[(N[(x + N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / N[(N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision] + N[(t$95$0 * N[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 + \left(x - x\right)}{\mathsf{fma}\left(\sqrt[3]{x}, \frac{x + \left(1 + x\right)}{{\left(\sqrt[3]{x}\right)}^{2} + t\_0 \cdot \left(t\_0 - \sqrt[3]{x}\right)}, {t\_0}^{2}\right)}
\end{array}
\end{array}
Initial program 7.2%
flip3--7.2%
div-inv7.2%
rem-cube-cbrt7.1%
rem-cube-cbrt10.5%
+-commutative10.5%
distribute-rgt-out10.5%
+-commutative10.5%
fma-define10.5%
add-exp-log10.4%
Applied egg-rr10.4%
associate-*r/10.4%
*-rgt-identity10.4%
+-commutative10.4%
associate--l+93.3%
+-commutative93.3%
+-commutative93.3%
Simplified93.3%
*-commutative93.3%
log1p-undefine93.3%
exp-to-pow93.2%
metadata-eval93.2%
pow-sqr93.2%
+-commutative93.2%
pow1/394.7%
+-commutative94.7%
pow1/398.5%
pow298.5%
+-commutative98.5%
Applied egg-rr98.5%
add-exp-log95.5%
log1p-undefine95.5%
Applied egg-rr95.5%
flip3-+95.5%
rem-cube-cbrt95.5%
pow1/392.3%
log1p-undefine92.3%
add-exp-log92.9%
pow1/394.1%
rem-cube-cbrt94.2%
pow294.2%
Applied egg-rr99.5%
(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 7.2%
flip3--7.2%
div-inv7.2%
rem-cube-cbrt7.1%
rem-cube-cbrt10.5%
+-commutative10.5%
distribute-rgt-out10.5%
+-commutative10.5%
fma-define10.5%
add-exp-log10.4%
Applied egg-rr10.4%
associate-*r/10.4%
*-rgt-identity10.4%
+-commutative10.4%
associate--l+93.3%
+-commutative93.3%
+-commutative93.3%
Simplified93.3%
*-commutative93.3%
log1p-undefine93.3%
exp-to-pow93.2%
metadata-eval93.2%
pow-sqr93.2%
+-commutative93.2%
pow1/394.7%
+-commutative94.7%
pow1/398.5%
pow298.5%
+-commutative98.5%
Applied egg-rr98.5%
pow1/394.7%
add-sqr-sqrt94.7%
metadata-eval94.7%
unpow-prod-down94.7%
add-sqr-sqrt94.7%
hypot-1-def94.7%
metadata-eval94.7%
add-sqr-sqrt94.7%
hypot-1-def94.7%
metadata-eval94.7%
Applied egg-rr94.7%
unpow1/396.1%
hypot-undefine96.1%
metadata-eval96.1%
rem-square-sqrt96.1%
unpow1/398.6%
hypot-undefine98.6%
metadata-eval98.6%
rem-square-sqrt98.6%
Simplified98.6%
Taylor expanded in x around 0 98.6%
(FPCore (x) :precision binary64 (/ (+ 1.0 (- x x)) (fma (cbrt x) (+ (cbrt x) (cbrt (/ 1.0 (/ 1.0 (+ 1.0 x))))) (pow (cbrt (+ 1.0 x)) 2.0))))
double code(double x) {
return (1.0 + (x - x)) / fma(cbrt(x), (cbrt(x) + cbrt((1.0 / (1.0 / (1.0 + x))))), pow(cbrt((1.0 + x)), 2.0));
}
function code(x) return Float64(Float64(1.0 + Float64(x - x)) / fma(cbrt(x), Float64(cbrt(x) + cbrt(Float64(1.0 / Float64(1.0 / Float64(1.0 + x))))), (cbrt(Float64(1.0 + x)) ^ 2.0))) end
code[x_] := N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + N[Power[N[(1.0 / N[(1.0 / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 + \left(x - x\right)}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{\frac{1}{\frac{1}{1 + x}}}, {\left(\sqrt[3]{1 + x}\right)}^{2}\right)}
\end{array}
Initial program 7.2%
flip3--7.2%
div-inv7.2%
rem-cube-cbrt7.1%
rem-cube-cbrt10.5%
+-commutative10.5%
distribute-rgt-out10.5%
+-commutative10.5%
fma-define10.5%
add-exp-log10.4%
Applied egg-rr10.4%
associate-*r/10.4%
*-rgt-identity10.4%
+-commutative10.4%
associate--l+93.3%
+-commutative93.3%
+-commutative93.3%
Simplified93.3%
*-commutative93.3%
log1p-undefine93.3%
exp-to-pow93.2%
metadata-eval93.2%
pow-sqr93.2%
+-commutative93.2%
pow1/394.7%
+-commutative94.7%
pow1/398.5%
pow298.5%
+-commutative98.5%
Applied egg-rr98.5%
add-exp-log95.5%
log1p-undefine95.5%
Applied egg-rr95.5%
log1p-undefine95.5%
add-exp-log98.5%
/-rgt-identity98.5%
clear-num98.5%
Applied egg-rr98.5%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x)))) (/ (+ 1.0 (- x x)) (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 + (x - x)) / fma(cbrt(x), (cbrt(x) + t_0), pow(t_0, 2.0));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(Float64(1.0 + Float64(x - x)) / 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[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / 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 + \left(x - x\right)}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t\_0, {t\_0}^{2}\right)}
\end{array}
\end{array}
Initial program 7.2%
flip3--7.2%
div-inv7.2%
rem-cube-cbrt7.1%
rem-cube-cbrt10.5%
+-commutative10.5%
distribute-rgt-out10.5%
+-commutative10.5%
fma-define10.5%
add-exp-log10.4%
Applied egg-rr10.4%
associate-*r/10.4%
*-rgt-identity10.4%
+-commutative10.4%
associate--l+93.3%
+-commutative93.3%
+-commutative93.3%
Simplified93.3%
*-commutative93.3%
log1p-undefine93.3%
exp-to-pow93.2%
metadata-eval93.2%
pow-sqr93.2%
+-commutative93.2%
pow1/394.7%
+-commutative94.7%
pow1/398.5%
pow298.5%
+-commutative98.5%
Applied egg-rr98.5%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1.0 (- x x))))
(if (<= x 1.5e+154)
(/
t_0
(+
(cbrt (pow (+ 1.0 x) 2.0))
(+ (pow (cbrt x) 2.0) (cbrt (* x (+ 1.0 x))))))
(/ t_0 (fma (cbrt x) (* (cbrt x) 2.0) (pow (cbrt (+ 1.0 x)) 2.0))))))
double code(double x) {
double t_0 = 1.0 + (x - x);
double tmp;
if (x <= 1.5e+154) {
tmp = t_0 / (cbrt(pow((1.0 + x), 2.0)) + (pow(cbrt(x), 2.0) + cbrt((x * (1.0 + x)))));
} else {
tmp = t_0 / fma(cbrt(x), (cbrt(x) * 2.0), pow(cbrt((1.0 + x)), 2.0));
}
return tmp;
}
function code(x) t_0 = Float64(1.0 + Float64(x - x)) tmp = 0.0 if (x <= 1.5e+154) tmp = Float64(t_0 / Float64(cbrt((Float64(1.0 + x) ^ 2.0)) + Float64((cbrt(x) ^ 2.0) + cbrt(Float64(x * Float64(1.0 + x)))))); else tmp = Float64(t_0 / fma(cbrt(x), Float64(cbrt(x) * 2.0), (cbrt(Float64(1.0 + x)) ^ 2.0))); end return tmp end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.5e+154], N[(t$95$0 / N[(N[Power[N[Power[N[(1.0 + x), $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(x * N[(1.0 + x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] * 2.0), $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 := 1 + \left(x - x\right)\\
\mathbf{if}\;x \leq 1.5 \cdot 10^{+154}:\\
\;\;\;\;\frac{t\_0}{\sqrt[3]{{\left(1 + x\right)}^{2}} + \left({\left(\sqrt[3]{x}\right)}^{2} + \sqrt[3]{x \cdot \left(1 + x\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} \cdot 2, {\left(\sqrt[3]{1 + x}\right)}^{2}\right)}\\
\end{array}
\end{array}
if x < 1.50000000000000013e154Initial program 9.6%
flip3--9.6%
div-inv9.6%
rem-cube-cbrt11.1%
rem-cube-cbrt16.2%
+-commutative16.2%
distribute-rgt-out16.2%
+-commutative16.2%
fma-define16.2%
add-exp-log16.1%
Applied egg-rr16.0%
associate-*r/16.0%
*-rgt-identity16.0%
+-commutative16.0%
associate--l+94.6%
+-commutative94.6%
+-commutative94.6%
Simplified94.6%
*-commutative94.6%
log1p-undefine94.6%
exp-to-pow94.8%
metadata-eval94.8%
pow-sqr94.8%
+-commutative94.8%
pow1/396.2%
+-commutative96.2%
pow1/398.5%
pow298.5%
+-commutative98.5%
Applied egg-rr98.5%
add-exp-log96.8%
log1p-undefine96.8%
Applied egg-rr96.8%
fma-undefine96.8%
log1p-undefine96.8%
add-exp-log98.5%
distribute-rgt-in98.5%
+-commutative98.5%
associate-+r+98.5%
unpow298.5%
cbrt-unprod98.9%
pow298.9%
pow298.9%
cbrt-unprod99.1%
Applied egg-rr99.1%
associate-+l+99.2%
*-commutative99.2%
Simplified99.2%
if 1.50000000000000013e154 < x Initial program 4.8%
flip3--4.8%
div-inv4.8%
rem-cube-cbrt3.1%
rem-cube-cbrt4.8%
+-commutative4.8%
distribute-rgt-out4.8%
+-commutative4.8%
fma-define4.8%
add-exp-log4.8%
Applied egg-rr4.8%
associate-*r/4.8%
*-rgt-identity4.8%
+-commutative4.8%
associate--l+92.0%
+-commutative92.0%
+-commutative92.0%
Simplified92.0%
*-commutative92.0%
log1p-undefine92.0%
exp-to-pow91.6%
metadata-eval91.6%
pow-sqr91.6%
+-commutative91.6%
pow1/393.2%
+-commutative93.2%
pow1/398.5%
pow298.5%
+-commutative98.5%
Applied egg-rr98.5%
Taylor expanded in x around inf 98.5%
*-commutative98.5%
Simplified98.5%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (+ 1.0 (- x x))))
(if (<= x 1.5e+154)
(/ t_1 (+ (cbrt (pow (+ 1.0 x) 2.0)) (* (cbrt x) (+ (cbrt x) t_0))))
(/ t_1 (fma (cbrt x) (* (cbrt x) 2.0) (pow t_0 2.0))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double t_1 = 1.0 + (x - x);
double tmp;
if (x <= 1.5e+154) {
tmp = t_1 / (cbrt(pow((1.0 + x), 2.0)) + (cbrt(x) * (cbrt(x) + t_0)));
} else {
tmp = t_1 / fma(cbrt(x), (cbrt(x) * 2.0), pow(t_0, 2.0));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) t_1 = Float64(1.0 + Float64(x - x)) tmp = 0.0 if (x <= 1.5e+154) tmp = Float64(t_1 / Float64(cbrt((Float64(1.0 + x) ^ 2.0)) + Float64(cbrt(x) * Float64(cbrt(x) + t_0)))); else tmp = Float64(t_1 / fma(cbrt(x), Float64(cbrt(x) * 2.0), (t_0 ^ 2.0))); end return tmp end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.5e+154], N[(t$95$1 / N[(N[Power[N[Power[N[(1.0 + x), $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] * 2.0), $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 := 1 + \left(x - x\right)\\
\mathbf{if}\;x \leq 1.5 \cdot 10^{+154}:\\
\;\;\;\;\frac{t\_1}{\sqrt[3]{{\left(1 + x\right)}^{2}} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} \cdot 2, {t\_0}^{2}\right)}\\
\end{array}
\end{array}
if x < 1.50000000000000013e154Initial program 9.6%
flip3--9.6%
div-inv9.6%
rem-cube-cbrt11.1%
rem-cube-cbrt16.2%
+-commutative16.2%
distribute-rgt-out16.2%
+-commutative16.2%
fma-define16.2%
add-exp-log16.1%
Applied egg-rr16.0%
associate-*r/16.0%
*-rgt-identity16.0%
+-commutative16.0%
associate--l+94.6%
+-commutative94.6%
+-commutative94.6%
Simplified94.6%
*-commutative94.6%
log1p-undefine94.6%
exp-to-pow94.8%
metadata-eval94.8%
pow-sqr94.8%
+-commutative94.8%
pow1/396.2%
+-commutative96.2%
pow1/398.5%
pow298.5%
+-commutative98.5%
Applied egg-rr98.5%
add-exp-log96.8%
log1p-undefine96.8%
Applied egg-rr96.8%
fma-undefine96.8%
+-commutative96.8%
log1p-undefine96.8%
add-exp-log98.5%
unpow298.5%
cbrt-unprod98.8%
pow298.8%
Applied egg-rr98.8%
if 1.50000000000000013e154 < x Initial program 4.8%
flip3--4.8%
div-inv4.8%
rem-cube-cbrt3.1%
rem-cube-cbrt4.8%
+-commutative4.8%
distribute-rgt-out4.8%
+-commutative4.8%
fma-define4.8%
add-exp-log4.8%
Applied egg-rr4.8%
associate-*r/4.8%
*-rgt-identity4.8%
+-commutative4.8%
associate--l+92.0%
+-commutative92.0%
+-commutative92.0%
Simplified92.0%
*-commutative92.0%
log1p-undefine92.0%
exp-to-pow91.6%
metadata-eval91.6%
pow-sqr91.6%
+-commutative91.6%
pow1/393.2%
+-commutative93.2%
pow1/398.5%
pow298.5%
+-commutative98.5%
Applied egg-rr98.5%
Taylor expanded in x around inf 98.5%
*-commutative98.5%
Simplified98.5%
Final simplification98.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(if (<= x 4e+14)
(/ 1.0 (fma (cbrt x) (+ (cbrt x) t_0) (pow (+ 1.0 x) 0.6666666666666666)))
(/ (+ 1.0 (- x x)) (fma (cbrt x) (* (cbrt x) 2.0) (pow t_0 2.0))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double tmp;
if (x <= 4e+14) {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + t_0), pow((1.0 + x), 0.6666666666666666));
} else {
tmp = (1.0 + (x - x)) / fma(cbrt(x), (cbrt(x) * 2.0), pow(t_0, 2.0));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) tmp = 0.0 if (x <= 4e+14) tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), (Float64(1.0 + x) ^ 0.6666666666666666))); else tmp = Float64(Float64(1.0 + Float64(x - x)) / fma(cbrt(x), Float64(cbrt(x) * 2.0), (t_0 ^ 2.0))); end return tmp end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[x, 4e+14], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] * 2.0), $MachinePrecision] + N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\mathbf{if}\;x \leq 4 \cdot 10^{+14}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t\_0, {\left(1 + x\right)}^{0.6666666666666666}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} \cdot 2, {t\_0}^{2}\right)}\\
\end{array}
\end{array}
if x < 4e14Initial program 51.2%
flip3--51.1%
div-inv51.1%
rem-cube-cbrt64.7%
rem-cube-cbrt98.9%
+-commutative98.9%
distribute-rgt-out99.0%
+-commutative99.0%
fma-define98.9%
add-exp-log98.2%
Applied egg-rr97.5%
associate-*r/97.4%
*-rgt-identity97.4%
+-commutative97.4%
associate--l+97.4%
+-commutative97.4%
+-commutative97.4%
Simplified97.4%
Taylor expanded in x around 0 97.4%
*-commutative97.4%
log1p-undefine97.4%
exp-to-pow98.0%
Applied egg-rr98.0%
if 4e14 < x Initial program 4.3%
flip3--4.3%
div-inv4.3%
rem-cube-cbrt3.3%
rem-cube-cbrt4.6%
+-commutative4.6%
distribute-rgt-out4.6%
+-commutative4.6%
fma-define4.6%
add-exp-log4.6%
Applied egg-rr4.6%
associate-*r/4.6%
*-rgt-identity4.6%
+-commutative4.6%
associate--l+93.1%
+-commutative93.1%
+-commutative93.1%
Simplified93.1%
*-commutative93.1%
log1p-undefine93.1%
exp-to-pow92.9%
metadata-eval92.9%
pow-sqr92.9%
+-commutative92.9%
pow1/394.4%
+-commutative94.4%
pow1/398.5%
pow298.5%
+-commutative98.5%
Applied egg-rr98.5%
Taylor expanded in x around inf 98.5%
*-commutative98.5%
Simplified98.5%
(FPCore (x)
:precision binary64
(if (<= x 1.2e+77)
(/
(fma
0.3333333333333333
(cbrt (pow x 4.0))
(* (cbrt x) -0.1111111111111111))
(pow x 2.0))
(/
1.0
(fma (cbrt x) (* (cbrt x) 2.0) (exp (* 0.6666666666666666 (log1p x)))))))
double code(double x) {
double tmp;
if (x <= 1.2e+77) {
tmp = fma(0.3333333333333333, cbrt(pow(x, 4.0)), (cbrt(x) * -0.1111111111111111)) / pow(x, 2.0);
} else {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) * 2.0), exp((0.6666666666666666 * log1p(x))));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.2e+77) tmp = Float64(fma(0.3333333333333333, cbrt((x ^ 4.0)), Float64(cbrt(x) * -0.1111111111111111)) / (x ^ 2.0)); else tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) * 2.0), exp(Float64(0.6666666666666666 * log1p(x))))); end return tmp end
code[x_] := If[LessEqual[x, 1.2e+77], 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] * 2.0), $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.2 \cdot 10^{+77}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.3333333333333333, \sqrt[3]{{x}^{4}}, \sqrt[3]{x} \cdot -0.1111111111111111\right)}{{x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} \cdot 2, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)}\\
\end{array}
\end{array}
if x < 1.1999999999999999e77Initial program 13.3%
Taylor expanded in x around inf 97.0%
+-commutative97.0%
fma-define97.0%
Simplified97.0%
if 1.1999999999999999e77 < x Initial program 4.5%
flip3--4.5%
div-inv4.5%
rem-cube-cbrt3.1%
rem-cube-cbrt4.5%
+-commutative4.5%
distribute-rgt-out4.5%
+-commutative4.5%
fma-define4.5%
add-exp-log4.5%
Applied egg-rr4.5%
associate-*r/4.5%
*-rgt-identity4.5%
+-commutative4.5%
associate--l+92.4%
+-commutative92.4%
+-commutative92.4%
Simplified92.4%
Taylor expanded in x around 0 92.4%
Taylor expanded in x around inf 92.4%
*-commutative98.5%
Simplified92.4%
Final simplification93.8%
(FPCore (x)
:precision binary64
(if (<= x 1.2e+77)
(/
(+
(* (cbrt x) -0.1111111111111111)
(* 0.3333333333333333 (cbrt (pow x 4.0))))
(pow x 2.0))
(/
1.0
(fma (cbrt x) (* (cbrt x) 2.0) (exp (* 0.6666666666666666 (log1p x)))))))
double code(double x) {
double tmp;
if (x <= 1.2e+77) {
tmp = ((cbrt(x) * -0.1111111111111111) + (0.3333333333333333 * cbrt(pow(x, 4.0)))) / pow(x, 2.0);
} else {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) * 2.0), exp((0.6666666666666666 * log1p(x))));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.2e+77) tmp = Float64(Float64(Float64(cbrt(x) * -0.1111111111111111) + Float64(0.3333333333333333 * cbrt((x ^ 4.0)))) / (x ^ 2.0)); else tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) * 2.0), exp(Float64(0.6666666666666666 * log1p(x))))); end return tmp end
code[x_] := If[LessEqual[x, 1.2e+77], 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] * 2.0), $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.2 \cdot 10^{+77}:\\
\;\;\;\;\frac{\sqrt[3]{x} \cdot -0.1111111111111111 + 0.3333333333333333 \cdot \sqrt[3]{{x}^{4}}}{{x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} \cdot 2, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)}\\
\end{array}
\end{array}
if x < 1.1999999999999999e77Initial program 13.3%
Taylor expanded in x around inf 97.0%
if 1.1999999999999999e77 < x Initial program 4.5%
flip3--4.5%
div-inv4.5%
rem-cube-cbrt3.1%
rem-cube-cbrt4.5%
+-commutative4.5%
distribute-rgt-out4.5%
+-commutative4.5%
fma-define4.5%
add-exp-log4.5%
Applied egg-rr4.5%
associate-*r/4.5%
*-rgt-identity4.5%
+-commutative4.5%
associate--l+92.4%
+-commutative92.4%
+-commutative92.4%
Simplified92.4%
Taylor expanded in x around 0 92.4%
Taylor expanded in x around inf 92.4%
*-commutative98.5%
Simplified92.4%
Final simplification93.8%
(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 7.2%
flip3--7.2%
div-inv7.2%
rem-cube-cbrt7.1%
rem-cube-cbrt10.5%
+-commutative10.5%
distribute-rgt-out10.5%
+-commutative10.5%
fma-define10.5%
add-exp-log10.4%
Applied egg-rr10.4%
associate-*r/10.4%
*-rgt-identity10.4%
+-commutative10.4%
associate--l+93.3%
+-commutative93.3%
+-commutative93.3%
Simplified93.3%
Taylor expanded in x around 0 93.3%
*-commutative93.3%
log1p-undefine93.3%
exp-to-pow93.2%
Applied egg-rr93.2%
(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 9.6%
Taylor expanded in x around inf 94.8%
if 1.35000000000000003e154 < x Initial program 4.8%
flip3--4.8%
div-inv4.8%
rem-cube-cbrt3.1%
rem-cube-cbrt4.8%
+-commutative4.8%
distribute-rgt-out4.8%
+-commutative4.8%
fma-define4.8%
add-exp-log4.8%
Applied egg-rr4.8%
associate-*r/4.8%
*-rgt-identity4.8%
+-commutative4.8%
associate--l+92.0%
+-commutative92.0%
+-commutative92.0%
Simplified92.0%
*-commutative92.0%
log1p-undefine92.0%
exp-to-pow91.6%
metadata-eval91.6%
pow-sqr91.6%
+-commutative91.6%
pow1/393.2%
+-commutative93.2%
pow1/398.5%
pow298.5%
+-commutative98.5%
Applied egg-rr98.5%
Taylor expanded in x around 0 17.7%
(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 7.2%
Taylor expanded in x around inf 49.8%
(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 7.2%
Final simplification7.2%
(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 cbrt(x) end
code[x_] := N[Power[x, 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{x}
\end{array}
Initial program 7.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%
Taylor expanded in x around inf 5.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 2024170
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
:pre (and (> x 1.0) (< x 1e+308))
:alt
(! :herbie-platform default (/ 1 (+ (* (cbrt (+ x 1)) (cbrt (+ x 1))) (* (cbrt x) (cbrt (+ x 1))) (* (cbrt x) (cbrt x)))))
(- (cbrt (+ x 1.0)) (cbrt x)))