
(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 (sqrt x))) (t_1 (cbrt (+ 1.0 x)))) (/ 1.0 (fma (cbrt x) (+ (* t_0 t_0) t_1) (pow t_1 2.0)))))
double code(double x) {
double t_0 = cbrt(sqrt(x));
double t_1 = cbrt((1.0 + x));
return 1.0 / fma(cbrt(x), ((t_0 * t_0) + t_1), pow(t_1, 2.0));
}
function code(x) t_0 = cbrt(sqrt(x)) t_1 = cbrt(Float64(1.0 + x)) return Float64(1.0 / fma(cbrt(x), Float64(Float64(t_0 * t_0) + t_1), (t_1 ^ 2.0))) end
code[x_] := Block[{t$95$0 = N[Power[N[Sqrt[x], $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[(t$95$0 * t$95$0), $MachinePrecision] + t$95$1), $MachinePrecision] + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\sqrt{x}}\\
t_1 := \sqrt[3]{1 + x}\\
\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t\_0 \cdot t\_0 + t\_1, {t\_1}^{2}\right)}
\end{array}
\end{array}
Initial program 6.9%
flip3--7.0%
rem-cube-cbrt6.5%
rem-cube-cbrt9.0%
div-sub7.1%
cbrt-unprod5.9%
distribute-rgt-out5.9%
+-commutative5.9%
Applied egg-rr7.1%
div-sub9.0%
+-commutative9.0%
associate--l+53.2%
+-inverses53.2%
metadata-eval53.2%
+-commutative53.2%
fma-define53.2%
+-commutative53.2%
+-commutative53.2%
rem-exp-log52.1%
+-commutative52.1%
log1p-undefine52.1%
rem-exp-log51.5%
+-commutative51.5%
log1p-undefine51.5%
Simplified51.5%
pow1/351.1%
exp-sum51.1%
log1p-undefine51.1%
add-exp-log51.1%
log1p-undefine51.1%
add-exp-log51.0%
unpow-prod-down93.1%
+-commutative93.1%
pow1/394.5%
+-commutative94.5%
pow1/398.5%
pow298.5%
Applied egg-rr98.5%
add-cube-cbrt98.3%
pow398.4%
Applied egg-rr98.4%
rem-cube-cbrt98.5%
pow1/394.5%
add-sqr-sqrt94.5%
unpow-prod-down94.5%
Applied egg-rr94.5%
unpow1/395.9%
unpow1/398.5%
Simplified98.5%
Final simplification98.5%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x)))) (/ 1.0 (fma (cbrt x) (+ (cbrt x) t_0) (pow t_0 2.0)))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / fma(cbrt(x), (cbrt(x) + t_0), pow(t_0, 2.0));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), (t_0 ^ 2.0))) end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision] + N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t\_0, {t\_0}^{2}\right)}
\end{array}
\end{array}
Initial program 6.9%
flip3--7.0%
rem-cube-cbrt6.5%
rem-cube-cbrt9.0%
div-sub7.1%
cbrt-unprod5.9%
distribute-rgt-out5.9%
+-commutative5.9%
Applied egg-rr7.1%
div-sub9.0%
+-commutative9.0%
associate--l+53.2%
+-inverses53.2%
metadata-eval53.2%
+-commutative53.2%
fma-define53.2%
+-commutative53.2%
+-commutative53.2%
rem-exp-log52.1%
+-commutative52.1%
log1p-undefine52.1%
rem-exp-log51.5%
+-commutative51.5%
log1p-undefine51.5%
Simplified51.5%
pow1/351.1%
exp-sum51.1%
log1p-undefine51.1%
add-exp-log51.1%
log1p-undefine51.1%
add-exp-log51.0%
unpow-prod-down93.1%
+-commutative93.1%
pow1/394.5%
+-commutative94.5%
pow1/398.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))) (* x (cbrt (+ (/ 1.0 x) (/ 2.0 (* x x))))))))
double code(double x) {
return 1.0 / fma(cbrt(x), (cbrt(x) + cbrt((1.0 + x))), (x * cbrt(((1.0 / x) + (2.0 / (x * x))))));
}
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 / Float64(x * x))))))) 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[(x * x), $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 \cdot x}}\right)}
\end{array}
Initial program 6.9%
flip3--7.0%
rem-cube-cbrt6.5%
rem-cube-cbrt9.0%
div-sub7.1%
cbrt-unprod5.9%
distribute-rgt-out5.9%
+-commutative5.9%
Applied egg-rr7.1%
div-sub9.0%
+-commutative9.0%
associate--l+53.2%
+-inverses53.2%
metadata-eval53.2%
+-commutative53.2%
fma-define53.2%
+-commutative53.2%
+-commutative53.2%
rem-exp-log52.1%
+-commutative52.1%
log1p-undefine52.1%
rem-exp-log51.5%
+-commutative51.5%
log1p-undefine51.5%
Simplified51.5%
pow1/351.1%
exp-sum51.1%
log1p-undefine51.1%
add-exp-log51.1%
log1p-undefine51.1%
add-exp-log51.0%
unpow-prod-down93.1%
+-commutative93.1%
pow1/394.5%
+-commutative94.5%
pow1/398.5%
pow298.5%
Applied egg-rr98.5%
Taylor expanded in x around inf 97.8%
unpow297.8%
associate-*r/97.8%
metadata-eval97.8%
Simplified97.8%
(FPCore (x)
:precision binary64
(if (<= x 1.55e+231)
(*
(/ 1.0 x)
(/
(+
(* (cbrt x) -0.1111111111111111)
(+
(/ 0.06172839506172839 (cbrt (* x x)))
(* 0.3333333333333333 (* x (sqrt (* x (/ 1.0 (cbrt x))))))))
x))
(/
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.55e+231) {
tmp = (1.0 / x) * (((cbrt(x) * -0.1111111111111111) + ((0.06172839506172839 / cbrt((x * x))) + (0.3333333333333333 * (x * sqrt((x * (1.0 / cbrt(x)))))))) / x);
} 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.55e+231) tmp = Float64(Float64(1.0 / x) * Float64(Float64(Float64(cbrt(x) * -0.1111111111111111) + Float64(Float64(0.06172839506172839 / cbrt(Float64(x * x))) + Float64(0.3333333333333333 * Float64(x * sqrt(Float64(x * Float64(1.0 / cbrt(x)))))))) / x)); 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.55e+231], N[(N[(1.0 / x), $MachinePrecision] * N[(N[(N[(N[Power[x, 1/3], $MachinePrecision] * -0.1111111111111111), $MachinePrecision] + N[(N[(0.06172839506172839 / N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[(x * N[Sqrt[N[(x * N[(1.0 / N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 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[Power[N[(1.0 + x), $MachinePrecision], 0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.55 \cdot 10^{+231}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{\sqrt[3]{x} \cdot -0.1111111111111111 + \left(\frac{0.06172839506172839}{\sqrt[3]{x \cdot x}} + 0.3333333333333333 \cdot \left(x \cdot \sqrt{x \cdot \frac{1}{\sqrt[3]{x}}}\right)\right)}{x}\\
\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.54999999999999995e231Initial program 7.4%
Taylor expanded in x around inf 32.5%
add-sqr-sqrt32.4%
sqrt-unprod32.5%
*-commutative32.5%
*-commutative32.5%
swap-sqr32.4%
Applied egg-rr49.0%
rem-square-sqrt48.9%
sqrt-unprod49.0%
sqr-neg49.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
neg-sub00.0%
flip3--0.0%
Applied egg-rr49.0%
associate-/l*49.0%
+-lft-identity49.0%
mul0-lft49.0%
+-rgt-identity49.0%
Simplified49.0%
Applied egg-rr98.2%
if 1.54999999999999995e231 < x Initial program 5.1%
flip3--5.1%
rem-cube-cbrt3.1%
rem-cube-cbrt5.1%
div-sub5.1%
cbrt-unprod1.9%
distribute-rgt-out1.9%
+-commutative1.9%
Applied egg-rr5.1%
div-sub5.1%
+-commutative5.1%
associate--l+5.1%
+-inverses5.1%
metadata-eval5.1%
+-commutative5.1%
fma-define5.1%
+-commutative5.1%
+-commutative5.1%
rem-exp-log5.1%
+-commutative5.1%
log1p-undefine5.1%
rem-exp-log5.1%
+-commutative5.1%
log1p-undefine5.1%
Simplified5.1%
pow1/35.1%
exp-sum5.1%
log1p-undefine5.1%
add-exp-log5.1%
log1p-undefine5.1%
add-exp-log5.1%
unpow-prod-down91.3%
pow-prod-up91.3%
+-commutative91.3%
metadata-eval91.3%
Applied egg-rr91.3%
Final simplification96.6%
(FPCore (x)
:precision binary64
(if (<= x 1.55e+231)
(*
(/ 1.0 x)
(/
(+
(* (cbrt x) -0.1111111111111111)
(+
(/ 0.06172839506172839 (cbrt (* x x)))
(* 0.3333333333333333 (* x (sqrt (* x (/ 1.0 (cbrt x))))))))
x))
(/
1.0
(fma (cbrt x) (+ (cbrt x) (cbrt x)) (pow (+ 1.0 x) 0.6666666666666666)))))
double code(double x) {
double tmp;
if (x <= 1.55e+231) {
tmp = (1.0 / x) * (((cbrt(x) * -0.1111111111111111) + ((0.06172839506172839 / cbrt((x * x))) + (0.3333333333333333 * (x * sqrt((x * (1.0 / cbrt(x)))))))) / x);
} else {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + cbrt(x)), pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.55e+231) tmp = Float64(Float64(1.0 / x) * Float64(Float64(Float64(cbrt(x) * -0.1111111111111111) + Float64(Float64(0.06172839506172839 / cbrt(Float64(x * x))) + Float64(0.3333333333333333 * Float64(x * sqrt(Float64(x * Float64(1.0 / cbrt(x)))))))) / x)); else tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(x)), (Float64(1.0 + x) ^ 0.6666666666666666))); end return tmp end
code[x_] := If[LessEqual[x, 1.55e+231], N[(N[(1.0 / x), $MachinePrecision] * N[(N[(N[(N[Power[x, 1/3], $MachinePrecision] * -0.1111111111111111), $MachinePrecision] + N[(N[(0.06172839506172839 / N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[(x * N[Sqrt[N[(x * N[(1.0 / N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $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[Power[N[(1.0 + x), $MachinePrecision], 0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.55 \cdot 10^{+231}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{\sqrt[3]{x} \cdot -0.1111111111111111 + \left(\frac{0.06172839506172839}{\sqrt[3]{x \cdot x}} + 0.3333333333333333 \cdot \left(x \cdot \sqrt{x \cdot \frac{1}{\sqrt[3]{x}}}\right)\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{x}, {\left(1 + x\right)}^{0.6666666666666666}\right)}\\
\end{array}
\end{array}
if x < 1.54999999999999995e231Initial program 7.4%
Taylor expanded in x around inf 32.5%
add-sqr-sqrt32.4%
sqrt-unprod32.5%
*-commutative32.5%
*-commutative32.5%
swap-sqr32.4%
Applied egg-rr49.0%
rem-square-sqrt48.9%
sqrt-unprod49.0%
sqr-neg49.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
neg-sub00.0%
flip3--0.0%
Applied egg-rr49.0%
associate-/l*49.0%
+-lft-identity49.0%
mul0-lft49.0%
+-rgt-identity49.0%
Simplified49.0%
Applied egg-rr98.2%
if 1.54999999999999995e231 < x Initial program 5.1%
flip3--5.1%
rem-cube-cbrt3.1%
rem-cube-cbrt5.1%
div-sub5.1%
cbrt-unprod1.9%
distribute-rgt-out1.9%
+-commutative1.9%
Applied egg-rr5.1%
div-sub5.1%
+-commutative5.1%
associate--l+5.1%
+-inverses5.1%
metadata-eval5.1%
+-commutative5.1%
fma-define5.1%
+-commutative5.1%
+-commutative5.1%
rem-exp-log5.1%
+-commutative5.1%
log1p-undefine5.1%
rem-exp-log5.1%
+-commutative5.1%
log1p-undefine5.1%
Simplified5.1%
pow1/35.1%
exp-sum5.1%
log1p-undefine5.1%
add-exp-log5.1%
log1p-undefine5.1%
add-exp-log5.1%
unpow-prod-down91.3%
pow-prod-up91.3%
+-commutative91.3%
metadata-eval91.3%
Applied egg-rr91.3%
Taylor expanded in x around inf 91.3%
Final simplification96.6%
(FPCore (x)
:precision binary64
(if (<= x 1.55e+231)
(*
(/ 1.0 x)
(/
(+
(* (cbrt x) -0.1111111111111111)
(+
(/ 0.06172839506172839 (cbrt (* x x)))
(* 0.3333333333333333 (* x (sqrt (* x (/ 1.0 (cbrt x))))))))
x))
(/ 1.0 (fma (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x))) 1.0))))
double code(double x) {
double tmp;
if (x <= 1.55e+231) {
tmp = (1.0 / x) * (((cbrt(x) * -0.1111111111111111) + ((0.06172839506172839 / cbrt((x * x))) + (0.3333333333333333 * (x * sqrt((x * (1.0 / cbrt(x)))))))) / x);
} 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.55e+231) tmp = Float64(Float64(1.0 / x) * Float64(Float64(Float64(cbrt(x) * -0.1111111111111111) + Float64(Float64(0.06172839506172839 / cbrt(Float64(x * x))) + Float64(0.3333333333333333 * Float64(x * sqrt(Float64(x * Float64(1.0 / cbrt(x)))))))) / x)); 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.55e+231], N[(N[(1.0 / x), $MachinePrecision] * N[(N[(N[(N[Power[x, 1/3], $MachinePrecision] * -0.1111111111111111), $MachinePrecision] + N[(N[(0.06172839506172839 / N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[(x * N[Sqrt[N[(x * N[(1.0 / N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 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] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.55 \cdot 10^{+231}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{\sqrt[3]{x} \cdot -0.1111111111111111 + \left(\frac{0.06172839506172839}{\sqrt[3]{x \cdot x}} + 0.3333333333333333 \cdot \left(x \cdot \sqrt{x \cdot \frac{1}{\sqrt[3]{x}}}\right)\right)}{x}\\
\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.54999999999999995e231Initial program 7.4%
Taylor expanded in x around inf 32.5%
add-sqr-sqrt32.4%
sqrt-unprod32.5%
*-commutative32.5%
*-commutative32.5%
swap-sqr32.4%
Applied egg-rr49.0%
rem-square-sqrt48.9%
sqrt-unprod49.0%
sqr-neg49.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
neg-sub00.0%
flip3--0.0%
Applied egg-rr49.0%
associate-/l*49.0%
+-lft-identity49.0%
mul0-lft49.0%
+-rgt-identity49.0%
Simplified49.0%
Applied egg-rr98.2%
if 1.54999999999999995e231 < x Initial program 5.1%
flip3--5.1%
rem-cube-cbrt3.1%
rem-cube-cbrt5.1%
div-sub5.1%
cbrt-unprod1.9%
distribute-rgt-out1.9%
+-commutative1.9%
Applied egg-rr5.1%
div-sub5.1%
+-commutative5.1%
associate--l+5.1%
+-inverses5.1%
metadata-eval5.1%
+-commutative5.1%
fma-define5.1%
+-commutative5.1%
+-commutative5.1%
rem-exp-log5.1%
+-commutative5.1%
log1p-undefine5.1%
rem-exp-log5.1%
+-commutative5.1%
log1p-undefine5.1%
Simplified5.1%
Taylor expanded in x around 0 19.9%
(FPCore (x)
:precision binary64
(if (<= x 1.55e+231)
(/
(/
(+
(* (cbrt x) -0.1111111111111111)
(+
(/ 0.06172839506172839 (cbrt (* x x)))
(* 0.3333333333333333 (* x (cbrt x)))))
x)
x)
(/ 1.0 (fma (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x))) 1.0))))
double code(double x) {
double tmp;
if (x <= 1.55e+231) {
tmp = (((cbrt(x) * -0.1111111111111111) + ((0.06172839506172839 / cbrt((x * x))) + (0.3333333333333333 * (x * cbrt(x))))) / x) / x;
} 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.55e+231) tmp = Float64(Float64(Float64(Float64(cbrt(x) * -0.1111111111111111) + Float64(Float64(0.06172839506172839 / cbrt(Float64(x * x))) + Float64(0.3333333333333333 * Float64(x * cbrt(x))))) / x) / x); 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.55e+231], N[(N[(N[(N[(N[Power[x, 1/3], $MachinePrecision] * -0.1111111111111111), $MachinePrecision] + N[(N[(0.06172839506172839 / N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[(x * N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / x), $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.55 \cdot 10^{+231}:\\
\;\;\;\;\frac{\frac{\sqrt[3]{x} \cdot -0.1111111111111111 + \left(\frac{0.06172839506172839}{\sqrt[3]{x \cdot x}} + 0.3333333333333333 \cdot \left(x \cdot \sqrt[3]{x}\right)\right)}{x}}{x}\\
\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.54999999999999995e231Initial program 7.4%
Taylor expanded in x around inf 32.5%
add-sqr-sqrt32.4%
sqrt-unprod32.5%
*-commutative32.5%
*-commutative32.5%
swap-sqr32.4%
Applied egg-rr49.0%
pow249.0%
associate-/r*49.8%
Applied egg-rr98.2%
if 1.54999999999999995e231 < x Initial program 5.1%
flip3--5.1%
rem-cube-cbrt3.1%
rem-cube-cbrt5.1%
div-sub5.1%
cbrt-unprod1.9%
distribute-rgt-out1.9%
+-commutative1.9%
Applied egg-rr5.1%
div-sub5.1%
+-commutative5.1%
associate--l+5.1%
+-inverses5.1%
metadata-eval5.1%
+-commutative5.1%
fma-define5.1%
+-commutative5.1%
+-commutative5.1%
rem-exp-log5.1%
+-commutative5.1%
log1p-undefine5.1%
rem-exp-log5.1%
+-commutative5.1%
log1p-undefine5.1%
Simplified5.1%
Taylor expanded in x around 0 19.9%
(FPCore (x)
:precision binary64
(if (<= x 1.35e+154)
(-
0.0
(/
(+
(* (cbrt x) -0.1111111111111111)
(+
(* 0.3333333333333333 (* x (cbrt x)))
(- 0.0 (/ (- 0.06172839506172839) (pow x 0.6666666666666666)))))
(* x (- x))))
(/ 1.0 (+ 1.0 (* (cbrt x) (+ 1.0 (cbrt x)))))))
double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = 0.0 - (((cbrt(x) * -0.1111111111111111) + ((0.3333333333333333 * (x * cbrt(x))) + (0.0 - (-0.06172839506172839 / pow(x, 0.6666666666666666))))) / (x * -x));
} 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.0 - (((Math.cbrt(x) * -0.1111111111111111) + ((0.3333333333333333 * (x * Math.cbrt(x))) + (0.0 - (-0.06172839506172839 / Math.pow(x, 0.6666666666666666))))) / (x * -x));
} 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.0 - Float64(Float64(Float64(cbrt(x) * -0.1111111111111111) + Float64(Float64(0.3333333333333333 * Float64(x * cbrt(x))) + Float64(0.0 - Float64(Float64(-0.06172839506172839) / (x ^ 0.6666666666666666))))) / Float64(x * Float64(-x)))); 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.0 - N[(N[(N[(N[Power[x, 1/3], $MachinePrecision] * -0.1111111111111111), $MachinePrecision] + N[(N[(0.3333333333333333 * N[(x * N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.0 - N[((-0.06172839506172839) / N[Power[x, 0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x * (-x)), $MachinePrecision]), $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 - \frac{\sqrt[3]{x} \cdot -0.1111111111111111 + \left(0.3333333333333333 \cdot \left(x \cdot \sqrt[3]{x}\right) + \left(0 - \frac{-0.06172839506172839}{{x}^{0.6666666666666666}}\right)\right)}{x \cdot \left(-x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + \sqrt[3]{x} \cdot \left(1 + \sqrt[3]{x}\right)}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 8.9%
Taylor expanded in x around inf 48.9%
add-sqr-sqrt48.8%
sqrt-unprod48.9%
*-commutative48.9%
*-commutative48.9%
swap-sqr48.9%
Applied egg-rr73.9%
*-un-lft-identity73.9%
Applied egg-rr97.8%
pow297.8%
pow1/397.8%
pow-pow97.8%
metadata-eval97.8%
Applied egg-rr97.8%
if 1.35000000000000003e154 < x Initial program 4.7%
flip3--4.7%
rem-cube-cbrt3.1%
rem-cube-cbrt4.7%
div-sub4.7%
cbrt-unprod1.9%
distribute-rgt-out1.9%
+-commutative1.9%
Applied egg-rr4.7%
div-sub4.7%
+-commutative4.7%
associate--l+4.7%
+-inverses4.7%
metadata-eval4.7%
+-commutative4.7%
fma-define4.7%
+-commutative4.7%
+-commutative4.7%
rem-exp-log4.7%
+-commutative4.7%
log1p-undefine4.7%
rem-exp-log4.7%
+-commutative4.7%
log1p-undefine4.7%
Simplified4.7%
pow1/34.7%
exp-sum4.7%
log1p-undefine4.7%
add-exp-log4.7%
log1p-undefine4.7%
add-exp-log4.7%
unpow-prod-down91.6%
pow-prod-up91.6%
+-commutative91.6%
metadata-eval91.6%
Applied egg-rr91.6%
Taylor expanded in x around 0 17.7%
Final simplification59.0%
(FPCore (x)
:precision binary64
(if (<= x 1.55e+231)
(/
(/
(+
(* (cbrt x) -0.1111111111111111)
(+
(/ 0.06172839506172839 (cbrt (* x x)))
(* 0.3333333333333333 (* x (cbrt x)))))
x)
x)
(/ 1.0 (+ 1.0 (* (cbrt x) (+ 1.0 (cbrt x)))))))
double code(double x) {
double tmp;
if (x <= 1.55e+231) {
tmp = (((cbrt(x) * -0.1111111111111111) + ((0.06172839506172839 / cbrt((x * x))) + (0.3333333333333333 * (x * cbrt(x))))) / x) / x;
} 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.55e+231) {
tmp = (((Math.cbrt(x) * -0.1111111111111111) + ((0.06172839506172839 / Math.cbrt((x * x))) + (0.3333333333333333 * (x * Math.cbrt(x))))) / x) / x;
} 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.55e+231) tmp = Float64(Float64(Float64(Float64(cbrt(x) * -0.1111111111111111) + Float64(Float64(0.06172839506172839 / cbrt(Float64(x * x))) + Float64(0.3333333333333333 * Float64(x * cbrt(x))))) / x) / x); 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.55e+231], N[(N[(N[(N[(N[Power[x, 1/3], $MachinePrecision] * -0.1111111111111111), $MachinePrecision] + N[(N[(0.06172839506172839 / N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[(x * N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / x), $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.55 \cdot 10^{+231}:\\
\;\;\;\;\frac{\frac{\sqrt[3]{x} \cdot -0.1111111111111111 + \left(\frac{0.06172839506172839}{\sqrt[3]{x \cdot x}} + 0.3333333333333333 \cdot \left(x \cdot \sqrt[3]{x}\right)\right)}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + \sqrt[3]{x} \cdot \left(1 + \sqrt[3]{x}\right)}\\
\end{array}
\end{array}
if x < 1.54999999999999995e231Initial program 7.4%
Taylor expanded in x around inf 32.5%
add-sqr-sqrt32.4%
sqrt-unprod32.5%
*-commutative32.5%
*-commutative32.5%
swap-sqr32.4%
Applied egg-rr49.0%
pow249.0%
associate-/r*49.8%
Applied egg-rr98.2%
if 1.54999999999999995e231 < x Initial program 5.1%
flip3--5.1%
rem-cube-cbrt3.1%
rem-cube-cbrt5.1%
div-sub5.1%
cbrt-unprod1.9%
distribute-rgt-out1.9%
+-commutative1.9%
Applied egg-rr5.1%
div-sub5.1%
+-commutative5.1%
associate--l+5.1%
+-inverses5.1%
metadata-eval5.1%
+-commutative5.1%
fma-define5.1%
+-commutative5.1%
+-commutative5.1%
rem-exp-log5.1%
+-commutative5.1%
log1p-undefine5.1%
rem-exp-log5.1%
+-commutative5.1%
log1p-undefine5.1%
Simplified5.1%
pow1/35.1%
exp-sum5.1%
log1p-undefine5.1%
add-exp-log5.1%
log1p-undefine5.1%
add-exp-log5.1%
unpow-prod-down91.3%
pow-prod-up91.3%
+-commutative91.3%
metadata-eval91.3%
Applied egg-rr91.3%
Taylor expanded in x around 0 17.7%
(FPCore (x) :precision binary64 (if (<= x 6.2e+161) (* 0.3333333333333333 (cbrt (/ (/ 1.0 x) x))) (/ 1.0 (+ 1.0 (* (cbrt x) (+ 1.0 (cbrt x)))))))
double code(double x) {
double tmp;
if (x <= 6.2e+161) {
tmp = 0.3333333333333333 * cbrt(((1.0 / x) / x));
} else {
tmp = 1.0 / (1.0 + (cbrt(x) * (1.0 + cbrt(x))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 6.2e+161) {
tmp = 0.3333333333333333 * Math.cbrt(((1.0 / x) / x));
} else {
tmp = 1.0 / (1.0 + (Math.cbrt(x) * (1.0 + Math.cbrt(x))));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 6.2e+161) tmp = Float64(0.3333333333333333 * cbrt(Float64(Float64(1.0 / x) / x))); 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, 6.2e+161], N[(0.3333333333333333 * N[Power[N[(N[(1.0 / x), $MachinePrecision] / x), $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 6.2 \cdot 10^{+161}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt[3]{\frac{\frac{1}{x}}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + \sqrt[3]{x} \cdot \left(1 + \sqrt[3]{x}\right)}\\
\end{array}
\end{array}
if x < 6.20000000000000013e161Initial program 8.8%
Taylor expanded in x around inf 47.5%
add-sqr-sqrt47.4%
sqrt-unprod47.5%
*-commutative47.5%
*-commutative47.5%
swap-sqr47.4%
Applied egg-rr71.7%
*-un-lft-identity71.7%
Applied egg-rr95.0%
Taylor expanded in x around inf 92.4%
unpow292.4%
associate-/r*93.8%
Simplified93.8%
if 6.20000000000000013e161 < x Initial program 4.7%
flip3--4.7%
rem-cube-cbrt3.2%
rem-cube-cbrt4.7%
div-sub4.7%
cbrt-unprod1.9%
distribute-rgt-out1.9%
+-commutative1.9%
Applied egg-rr4.7%
div-sub4.7%
+-commutative4.7%
associate--l+4.7%
+-inverses4.7%
metadata-eval4.7%
+-commutative4.7%
fma-define4.7%
+-commutative4.7%
+-commutative4.7%
rem-exp-log4.7%
+-commutative4.7%
log1p-undefine4.7%
rem-exp-log4.7%
+-commutative4.7%
log1p-undefine4.7%
Simplified4.7%
pow1/34.7%
exp-sum4.7%
log1p-undefine4.7%
add-exp-log4.7%
log1p-undefine4.7%
add-exp-log4.7%
unpow-prod-down91.6%
pow-prod-up91.6%
+-commutative91.6%
metadata-eval91.6%
Applied egg-rr91.6%
Taylor expanded in x around 0 17.7%
(FPCore (x) :precision binary64 (* 0.3333333333333333 (cbrt (/ (/ 1.0 x) x))))
double code(double x) {
return 0.3333333333333333 * cbrt(((1.0 / x) / x));
}
public static double code(double x) {
return 0.3333333333333333 * Math.cbrt(((1.0 / x) / x));
}
function code(x) return Float64(0.3333333333333333 * cbrt(Float64(Float64(1.0 / x) / x))) end
code[x_] := N[(0.3333333333333333 * N[Power[N[(N[(1.0 / x), $MachinePrecision] / x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.3333333333333333 \cdot \sqrt[3]{\frac{\frac{1}{x}}{x}}
\end{array}
Initial program 6.9%
Taylor expanded in x around inf 25.2%
add-sqr-sqrt25.2%
sqrt-unprod25.2%
*-commutative25.2%
*-commutative25.2%
swap-sqr25.2%
Applied egg-rr38.1%
*-un-lft-identity38.1%
Applied egg-rr51.6%
Taylor expanded in x around inf 51.3%
unpow251.3%
associate-/r*52.1%
Simplified52.1%
(FPCore (x) :precision binary64 (* 0.3333333333333333 (cbrt (/ 1.0 (* x x)))))
double code(double x) {
return 0.3333333333333333 * cbrt((1.0 / (x * x)));
}
public static double code(double x) {
return 0.3333333333333333 * Math.cbrt((1.0 / (x * x)));
}
function code(x) return Float64(0.3333333333333333 * cbrt(Float64(1.0 / Float64(x * x)))) end
code[x_] := N[(0.3333333333333333 * N[Power[N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.3333333333333333 \cdot \sqrt[3]{\frac{1}{x \cdot x}}
\end{array}
Initial program 6.9%
Taylor expanded in x around inf 51.3%
unpow251.3%
Simplified51.3%
(FPCore (x) :precision binary64 (+ 1.0 (cbrt x)))
double code(double x) {
return 1.0 + cbrt(x);
}
public static double code(double x) {
return 1.0 + Math.cbrt(x);
}
function code(x) return Float64(1.0 + cbrt(x)) end
code[x_] := N[(1.0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \sqrt[3]{x}
\end{array}
Initial program 6.9%
Taylor expanded in x around 0 1.8%
pow1/31.8%
Applied egg-rr1.8%
sqr-pow1.8%
pow-prod-down1.4%
metadata-eval1.4%
Applied egg-rr1.4%
Taylor expanded in x around -inf 5.4%
neg-mul-15.4%
Simplified5.4%
Final simplification5.4%
(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.9%
Taylor expanded in x around 0 1.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 2024097
(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)))