
(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 16 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
(fma
(cbrt x)
(/ (+ x (+ 1.0 x)) (+ (pow t_0 2.0) (* (cbrt x) (- (cbrt x) t_0))))
(* t_0 t_0)))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / fma(cbrt(x), ((x + (1.0 + x)) / (pow(t_0, 2.0) + (cbrt(x) * (cbrt(x) - t_0)))), (t_0 * t_0));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / fma(cbrt(x), Float64(Float64(x + Float64(1.0 + x)) / Float64((t_0 ^ 2.0) + Float64(cbrt(x) * Float64(cbrt(x) - t_0)))), Float64(t_0 * t_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[(x + N[(1.0 + 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] + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \frac{x + \left(1 + x\right)}{{t\_0}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} - t\_0\right)}, t\_0 \cdot t\_0\right)}
\end{array}
\end{array}
Initial program 5.9%
flip3--6.1%
div-inv6.1%
rem-cube-cbrt5.1%
rem-cube-cbrt7.1%
+-commutative7.1%
distribute-rgt-out7.2%
+-commutative7.2%
fma-define7.2%
add-exp-log7.1%
Applied egg-rr7.1%
associate-*r/7.1%
*-rgt-identity7.1%
+-commutative7.1%
associate--l+93.3%
+-inverses93.3%
metadata-eval93.3%
+-commutative93.3%
exp-prod92.4%
Simplified92.4%
add-sqr-sqrt92.4%
unpow-prod-down94.0%
Applied egg-rr94.0%
pow-sqr94.0%
Simplified94.0%
sqr-pow94.0%
pow294.0%
pow-to-exp93.3%
*-commutative93.3%
associate-/l*93.3%
metadata-eval93.3%
*-commutative93.3%
*-un-lft-identity93.3%
pow1/293.3%
log-pow93.3%
rem-log-exp93.3%
metadata-eval93.3%
log1p-undefine93.3%
log-pow93.5%
pow1/394.0%
add-exp-log98.6%
pow298.6%
Applied egg-rr98.6%
flip3-+98.6%
rem-cube-cbrt99.1%
rem-cube-cbrt99.4%
+-commutative99.4%
+-commutative99.4%
+-commutative99.4%
pow299.4%
+-commutative99.4%
+-commutative99.4%
distribute-rgt-out--99.4%
+-commutative99.4%
Applied egg-rr99.4%
(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_0 (* t_1 t_1))))))
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_0 * (t_1 * t_1)));
}
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(t_0 * Float64(t_1 * t_1)))) 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[(t$95$0 * N[(t$95$1 * t$95$1), $MachinePrecision]), $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, t\_0 \cdot \left(t\_1 \cdot t\_1\right)\right)}
\end{array}
\end{array}
Initial program 5.9%
flip3--6.1%
div-inv6.1%
rem-cube-cbrt5.1%
rem-cube-cbrt7.1%
+-commutative7.1%
distribute-rgt-out7.2%
+-commutative7.2%
fma-define7.2%
add-exp-log7.1%
Applied egg-rr7.1%
associate-*r/7.1%
*-rgt-identity7.1%
+-commutative7.1%
associate--l+93.3%
+-inverses93.3%
metadata-eval93.3%
+-commutative93.3%
exp-prod92.4%
Simplified92.4%
add-sqr-sqrt92.4%
unpow-prod-down94.0%
Applied egg-rr94.0%
pow-sqr94.0%
Simplified94.0%
sqr-pow94.0%
pow294.0%
pow-to-exp93.3%
*-commutative93.3%
associate-/l*93.3%
metadata-eval93.3%
*-commutative93.3%
*-un-lft-identity93.3%
pow1/293.3%
log-pow93.3%
rem-log-exp93.3%
metadata-eval93.3%
log1p-undefine93.3%
log-pow93.5%
pow1/394.0%
add-exp-log98.6%
pow298.6%
Applied egg-rr98.6%
pow1/394.4%
add-sqr-sqrt94.4%
unpow-prod-down94.4%
Applied egg-rr94.4%
unpow1/395.8%
unpow1/398.6%
Simplified98.6%
Final simplification98.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(/
1.0
(fma
(cbrt x)
(+ (cbrt x) t_0)
(* t_0 (cbrt (pow (sqrt (+ 1.0 x)) 2.0)))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / fma(cbrt(x), (cbrt(x) + t_0), (t_0 * cbrt(pow(sqrt((1.0 + x)), 2.0))));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), Float64(t_0 * cbrt((sqrt(Float64(1.0 + x)) ^ 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[(t$95$0 * N[Power[N[Power[N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision]), $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 \cdot \sqrt[3]{{\left(\sqrt{1 + x}\right)}^{2}}\right)}
\end{array}
\end{array}
Initial program 5.9%
flip3--6.1%
div-inv6.1%
rem-cube-cbrt5.1%
rem-cube-cbrt7.1%
+-commutative7.1%
distribute-rgt-out7.2%
+-commutative7.2%
fma-define7.2%
add-exp-log7.1%
Applied egg-rr7.1%
associate-*r/7.1%
*-rgt-identity7.1%
+-commutative7.1%
associate--l+93.3%
+-inverses93.3%
metadata-eval93.3%
+-commutative93.3%
exp-prod92.4%
Simplified92.4%
add-sqr-sqrt92.4%
unpow-prod-down94.0%
Applied egg-rr94.0%
pow-sqr94.0%
Simplified94.0%
sqr-pow94.0%
pow294.0%
pow-to-exp93.3%
*-commutative93.3%
associate-/l*93.3%
metadata-eval93.3%
*-commutative93.3%
*-un-lft-identity93.3%
pow1/293.3%
log-pow93.3%
rem-log-exp93.3%
metadata-eval93.3%
log1p-undefine93.3%
log-pow93.5%
pow1/394.0%
add-exp-log98.6%
pow298.6%
Applied egg-rr98.6%
add-sqr-sqrt98.6%
pow298.6%
Applied egg-rr98.6%
Final simplification98.6%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x)))) (/ 1.0 (fma (cbrt x) (+ (cbrt x) t_0) (* t_0 t_0)))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / fma(cbrt(x), (cbrt(x) + t_0), (t_0 * t_0));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), Float64(t_0 * t_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[(t$95$0 * t$95$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 \cdot t\_0\right)}
\end{array}
\end{array}
Initial program 5.9%
flip3--6.1%
div-inv6.1%
rem-cube-cbrt5.1%
rem-cube-cbrt7.1%
+-commutative7.1%
distribute-rgt-out7.2%
+-commutative7.2%
fma-define7.2%
add-exp-log7.1%
Applied egg-rr7.1%
associate-*r/7.1%
*-rgt-identity7.1%
+-commutative7.1%
associate--l+93.3%
+-inverses93.3%
metadata-eval93.3%
+-commutative93.3%
exp-prod92.4%
Simplified92.4%
add-sqr-sqrt92.4%
unpow-prod-down94.0%
Applied egg-rr94.0%
pow-sqr94.0%
Simplified94.0%
sqr-pow94.0%
pow294.0%
pow-to-exp93.3%
*-commutative93.3%
associate-/l*93.3%
metadata-eval93.3%
*-commutative93.3%
*-un-lft-identity93.3%
pow1/293.3%
log-pow93.3%
rem-log-exp93.3%
metadata-eval93.3%
log1p-undefine93.3%
log-pow93.5%
pow1/394.0%
add-exp-log98.6%
pow298.6%
Applied egg-rr98.6%
Final simplification98.6%
(FPCore (x)
:precision binary64
(if (<= x 1e+154)
(/ 1.0 (* 3.0 (cbrt (pow x 2.0))))
(/
1.0
(fma (cbrt x) (* (cbrt x) 2.0) (exp (* (log1p x) 0.6666666666666666))))))
double code(double x) {
double tmp;
if (x <= 1e+154) {
tmp = 1.0 / (3.0 * cbrt(pow(x, 2.0)));
} else {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) * 2.0), exp((log1p(x) * 0.6666666666666666)));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1e+154) tmp = Float64(1.0 / Float64(3.0 * cbrt((x ^ 2.0)))); else tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) * 2.0), exp(Float64(log1p(x) * 0.6666666666666666)))); end return tmp end
code[x_] := If[LessEqual[x, 1e+154], N[(1.0 / N[(3.0 * 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] * 2.0), $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 10^{+154}:\\
\;\;\;\;\frac{1}{3 \cdot \sqrt[3]{{x}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} \cdot 2, e^{\mathsf{log1p}\left(x\right) \cdot 0.6666666666666666}\right)}\\
\end{array}
\end{array}
if x < 1.00000000000000004e154Initial program 6.9%
flip3--7.3%
div-inv7.3%
rem-cube-cbrt6.9%
rem-cube-cbrt9.4%
+-commutative9.4%
distribute-rgt-out9.4%
+-commutative9.4%
fma-define9.4%
add-exp-log9.3%
Applied egg-rr9.3%
associate-*r/9.3%
*-rgt-identity9.3%
+-commutative9.3%
associate--l+94.2%
+-inverses94.2%
metadata-eval94.2%
+-commutative94.2%
exp-prod93.6%
Simplified93.6%
Taylor expanded in x around inf 39.6%
distribute-rgt1-in39.6%
metadata-eval39.6%
Simplified39.6%
Taylor expanded in x around 0 96.8%
if 1.00000000000000004e154 < 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.2%
+-inverses92.2%
metadata-eval92.2%
+-commutative92.2%
exp-prod91.1%
Simplified91.1%
add-exp-log91.2%
log-pow92.2%
rem-log-exp92.2%
Applied egg-rr92.2%
Taylor expanded in x around inf 92.2%
*-commutative98.7%
Simplified92.2%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x)))) (/ 1.0 (fma (cbrt x) (* (cbrt x) 2.0) (* t_0 t_0)))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / fma(cbrt(x), (cbrt(x) * 2.0), (t_0 * t_0));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) * 2.0), Float64(t_0 * t_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] * 2.0), $MachinePrecision] + N[(t$95$0 * t$95$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} \cdot 2, t\_0 \cdot t\_0\right)}
\end{array}
\end{array}
Initial program 5.9%
flip3--6.1%
div-inv6.1%
rem-cube-cbrt5.1%
rem-cube-cbrt7.1%
+-commutative7.1%
distribute-rgt-out7.2%
+-commutative7.2%
fma-define7.2%
add-exp-log7.1%
Applied egg-rr7.1%
associate-*r/7.1%
*-rgt-identity7.1%
+-commutative7.1%
associate--l+93.3%
+-inverses93.3%
metadata-eval93.3%
+-commutative93.3%
exp-prod92.4%
Simplified92.4%
add-sqr-sqrt92.4%
unpow-prod-down94.0%
Applied egg-rr94.0%
pow-sqr94.0%
Simplified94.0%
sqr-pow94.0%
pow294.0%
pow-to-exp93.3%
*-commutative93.3%
associate-/l*93.3%
metadata-eval93.3%
*-commutative93.3%
*-un-lft-identity93.3%
pow1/293.3%
log-pow93.3%
rem-log-exp93.3%
metadata-eval93.3%
log1p-undefine93.3%
log-pow93.5%
pow1/394.0%
add-exp-log98.6%
pow298.6%
Applied egg-rr98.6%
Taylor expanded in x around inf 97.5%
*-commutative97.5%
Simplified97.5%
(FPCore (x) :precision binary64 (if (<= x 5.8e+161) (pow (/ 1.0 (* x (* (cbrt (pow x -2.0)) (sqrt 3.0)))) 2.0) (/ 1.0 (fma (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x))) 1.0))))
double code(double x) {
double tmp;
if (x <= 5.8e+161) {
tmp = pow((1.0 / (x * (cbrt(pow(x, -2.0)) * sqrt(3.0)))), 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 <= 5.8e+161) tmp = Float64(1.0 / Float64(x * Float64(cbrt((x ^ -2.0)) * sqrt(3.0)))) ^ 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, 5.8e+161], N[Power[N[(1.0 / N[(x * N[(N[Power[N[Power[x, -2.0], $MachinePrecision], 1/3], $MachinePrecision] * N[Sqrt[3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $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 5.8 \cdot 10^{+161}:\\
\;\;\;\;{\left(\frac{1}{x \cdot \left(\sqrt[3]{{x}^{-2}} \cdot \sqrt{3}\right)}\right)}^{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 < 5.80000000000000032e161Initial program 6.8%
flip3--7.2%
div-inv7.2%
rem-cube-cbrt6.7%
rem-cube-cbrt9.1%
+-commutative9.1%
distribute-rgt-out9.1%
+-commutative9.1%
fma-define9.1%
add-exp-log9.1%
Applied egg-rr9.1%
associate-*r/9.1%
*-rgt-identity9.1%
+-commutative9.1%
associate--l+94.1%
+-inverses94.1%
metadata-eval94.1%
+-commutative94.1%
exp-prod93.5%
Simplified93.5%
Taylor expanded in x around inf 37.6%
distribute-rgt1-in37.6%
metadata-eval37.6%
Simplified37.6%
add-sqr-sqrt37.7%
pow237.7%
Applied egg-rr94.3%
if 5.80000000000000032e161 < 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.3%
+-inverses92.3%
metadata-eval92.3%
+-commutative92.3%
exp-prod91.1%
Simplified91.1%
add-sqr-sqrt91.1%
unpow-prod-down92.8%
Applied egg-rr92.8%
pow-sqr92.8%
Simplified92.8%
Taylor expanded in x around 0 20.0%
Final simplification60.3%
(FPCore (x) :precision binary64 (if (<= x 5.8e+161) (pow (* x (* (cbrt (pow x -2.0)) (sqrt 3.0))) -2.0) (/ 1.0 (fma (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x))) 1.0))))
double code(double x) {
double tmp;
if (x <= 5.8e+161) {
tmp = pow((x * (cbrt(pow(x, -2.0)) * sqrt(3.0))), -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 <= 5.8e+161) tmp = Float64(x * Float64(cbrt((x ^ -2.0)) * sqrt(3.0))) ^ -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, 5.8e+161], N[Power[N[(x * N[(N[Power[N[Power[x, -2.0], $MachinePrecision], 1/3], $MachinePrecision] * N[Sqrt[3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $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 5.8 \cdot 10^{+161}:\\
\;\;\;\;{\left(x \cdot \left(\sqrt[3]{{x}^{-2}} \cdot \sqrt{3}\right)\right)}^{-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 < 5.80000000000000032e161Initial program 6.8%
flip3--7.2%
div-inv7.2%
rem-cube-cbrt6.7%
rem-cube-cbrt9.1%
+-commutative9.1%
distribute-rgt-out9.1%
+-commutative9.1%
fma-define9.1%
add-exp-log9.1%
Applied egg-rr9.1%
associate-*r/9.1%
*-rgt-identity9.1%
+-commutative9.1%
associate--l+94.1%
+-inverses94.1%
metadata-eval94.1%
+-commutative94.1%
exp-prod93.5%
Simplified93.5%
Taylor expanded in x around inf 37.6%
distribute-rgt1-in37.6%
metadata-eval37.6%
Simplified37.6%
add-sqr-sqrt37.7%
Applied egg-rr94.3%
unpow-194.3%
unpow-194.3%
pow-sqr94.3%
metadata-eval94.3%
Simplified94.3%
if 5.80000000000000032e161 < 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.3%
+-inverses92.3%
metadata-eval92.3%
+-commutative92.3%
exp-prod91.1%
Simplified91.1%
add-sqr-sqrt91.1%
unpow-prod-down92.8%
Applied egg-rr92.8%
pow-sqr92.8%
Simplified92.8%
Taylor expanded in x around 0 20.0%
Final simplification60.3%
(FPCore (x) :precision binary64 (if (<= x 5.8e+161) (pow (* x (* (cbrt (pow x -2.0)) (sqrt 3.0))) -2.0) (pow (* (cbrt x) (sqrt 2.0)) -2.0)))
double code(double x) {
double tmp;
if (x <= 5.8e+161) {
tmp = pow((x * (cbrt(pow(x, -2.0)) * sqrt(3.0))), -2.0);
} else {
tmp = pow((cbrt(x) * sqrt(2.0)), -2.0);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 5.8e+161) {
tmp = Math.pow((x * (Math.cbrt(Math.pow(x, -2.0)) * Math.sqrt(3.0))), -2.0);
} else {
tmp = Math.pow((Math.cbrt(x) * Math.sqrt(2.0)), -2.0);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 5.8e+161) tmp = Float64(x * Float64(cbrt((x ^ -2.0)) * sqrt(3.0))) ^ -2.0; else tmp = Float64(cbrt(x) * sqrt(2.0)) ^ -2.0; end return tmp end
code[x_] := If[LessEqual[x, 5.8e+161], N[Power[N[(x * N[(N[Power[N[Power[x, -2.0], $MachinePrecision], 1/3], $MachinePrecision] * N[Sqrt[3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision], N[Power[N[(N[Power[x, 1/3], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.8 \cdot 10^{+161}:\\
\;\;\;\;{\left(x \cdot \left(\sqrt[3]{{x}^{-2}} \cdot \sqrt{3}\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt[3]{x} \cdot \sqrt{2}\right)}^{-2}\\
\end{array}
\end{array}
if x < 5.80000000000000032e161Initial program 6.8%
flip3--7.2%
div-inv7.2%
rem-cube-cbrt6.7%
rem-cube-cbrt9.1%
+-commutative9.1%
distribute-rgt-out9.1%
+-commutative9.1%
fma-define9.1%
add-exp-log9.1%
Applied egg-rr9.1%
associate-*r/9.1%
*-rgt-identity9.1%
+-commutative9.1%
associate--l+94.1%
+-inverses94.1%
metadata-eval94.1%
+-commutative94.1%
exp-prod93.5%
Simplified93.5%
Taylor expanded in x around inf 37.6%
distribute-rgt1-in37.6%
metadata-eval37.6%
Simplified37.6%
add-sqr-sqrt37.7%
Applied egg-rr94.3%
unpow-194.3%
unpow-194.3%
pow-sqr94.3%
metadata-eval94.3%
Simplified94.3%
if 5.80000000000000032e161 < 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.3%
+-inverses92.3%
metadata-eval92.3%
+-commutative92.3%
exp-prod91.1%
Simplified91.1%
inv-pow91.1%
add-sqr-sqrt91.1%
unpow-prod-down91.1%
+-commutative91.1%
+-commutative91.1%
Applied egg-rr91.1%
pow-sqr91.1%
metadata-eval91.1%
Simplified91.1%
Taylor expanded in x around inf 20.0%
(FPCore (x) :precision binary64 (if (<= x 1.35e+154) (/ 1.0 (* 3.0 (cbrt (pow x 2.0)))) (pow (* (cbrt x) (sqrt 2.0)) -2.0)))
double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = 1.0 / (3.0 * cbrt(pow(x, 2.0)));
} else {
tmp = pow((cbrt(x) * sqrt(2.0)), -2.0);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = 1.0 / (3.0 * Math.cbrt(Math.pow(x, 2.0)));
} else {
tmp = Math.pow((Math.cbrt(x) * Math.sqrt(2.0)), -2.0);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.35e+154) tmp = Float64(1.0 / Float64(3.0 * cbrt((x ^ 2.0)))); else tmp = Float64(cbrt(x) * sqrt(2.0)) ^ -2.0; end return tmp end
code[x_] := If[LessEqual[x, 1.35e+154], N[(1.0 / N[(3.0 * N[Power[N[Power[x, 2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[Power[x, 1/3], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{3 \cdot \sqrt[3]{{x}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt[3]{x} \cdot \sqrt{2}\right)}^{-2}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 6.9%
flip3--7.3%
div-inv7.3%
rem-cube-cbrt6.9%
rem-cube-cbrt9.4%
+-commutative9.4%
distribute-rgt-out9.4%
+-commutative9.4%
fma-define9.4%
add-exp-log9.3%
Applied egg-rr9.3%
associate-*r/9.3%
*-rgt-identity9.3%
+-commutative9.3%
associate--l+94.2%
+-inverses94.2%
metadata-eval94.2%
+-commutative94.2%
exp-prod93.6%
Simplified93.6%
Taylor expanded in x around inf 39.6%
distribute-rgt1-in39.6%
metadata-eval39.6%
Simplified39.6%
Taylor expanded in x around 0 96.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.2%
+-inverses92.2%
metadata-eval92.2%
+-commutative92.2%
exp-prod91.1%
Simplified91.1%
inv-pow91.1%
add-sqr-sqrt91.1%
unpow-prod-down91.1%
+-commutative91.1%
+-commutative91.1%
Applied egg-rr91.1%
pow-sqr91.1%
metadata-eval91.1%
Simplified91.1%
Taylor expanded in x around inf 20.0%
(FPCore (x) :precision binary64 (if (<= x 1.35e+154) (/ 1.0 (* 3.0 (cbrt (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 = 1.0 / (3.0 * cbrt(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 = 1.0 / (3.0 * Math.cbrt(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(1.0 / Float64(3.0 * cbrt((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[(1.0 / N[(3.0 * N[Power[N[Power[x, 2.0], $MachinePrecision], 1/3], $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}:\\
\;\;\;\;\frac{1}{3 \cdot \sqrt[3]{{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.9%
flip3--7.3%
div-inv7.3%
rem-cube-cbrt6.9%
rem-cube-cbrt9.4%
+-commutative9.4%
distribute-rgt-out9.4%
+-commutative9.4%
fma-define9.4%
add-exp-log9.3%
Applied egg-rr9.3%
associate-*r/9.3%
*-rgt-identity9.3%
+-commutative9.3%
associate--l+94.2%
+-inverses94.2%
metadata-eval94.2%
+-commutative94.2%
exp-prod93.6%
Simplified93.6%
Taylor expanded in x around inf 39.6%
distribute-rgt1-in39.6%
metadata-eval39.6%
Simplified39.6%
Taylor expanded in x around 0 96.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.2%
+-inverses92.2%
metadata-eval92.2%
+-commutative92.2%
exp-prod91.1%
Simplified91.1%
Taylor expanded in x around 0 17.7%
(FPCore (x) :precision binary64 (/ 1.0 (* 3.0 (cbrt (pow x 2.0)))))
double code(double x) {
return 1.0 / (3.0 * cbrt(pow(x, 2.0)));
}
public static double code(double x) {
return 1.0 / (3.0 * Math.cbrt(Math.pow(x, 2.0)));
}
function code(x) return Float64(1.0 / Float64(3.0 * cbrt((x ^ 2.0)))) end
code[x_] := N[(1.0 / N[(3.0 * N[Power[N[Power[x, 2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{3 \cdot \sqrt[3]{{x}^{2}}}
\end{array}
Initial program 5.9%
flip3--6.1%
div-inv6.1%
rem-cube-cbrt5.1%
rem-cube-cbrt7.1%
+-commutative7.1%
distribute-rgt-out7.2%
+-commutative7.2%
fma-define7.2%
add-exp-log7.1%
Applied egg-rr7.1%
associate-*r/7.1%
*-rgt-identity7.1%
+-commutative7.1%
associate--l+93.3%
+-inverses93.3%
metadata-eval93.3%
+-commutative93.3%
exp-prod92.4%
Simplified92.4%
Taylor expanded in x around inf 20.4%
distribute-rgt1-in20.4%
metadata-eval20.4%
Simplified20.4%
Taylor expanded in x around 0 52.3%
(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.9%
Taylor expanded in x around inf 52.0%
(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 5.9%
Final simplification5.9%
(FPCore (x) :precision binary64 (- (cbrt x) (pow x 0.3333333333333333)))
double code(double x) {
return cbrt(x) - pow(x, 0.3333333333333333);
}
public static double code(double x) {
return Math.cbrt(x) - Math.pow(x, 0.3333333333333333);
}
function code(x) return Float64(cbrt(x) - (x ^ 0.3333333333333333)) end
code[x_] := N[(N[Power[x, 1/3], $MachinePrecision] - N[Power[x, 0.3333333333333333], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{x} - {x}^{0.3333333333333333}
\end{array}
Initial program 5.9%
pow1/36.9%
Applied egg-rr6.9%
Taylor expanded in x around inf 5.5%
(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 5.9%
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%
Taylor expanded in x around inf 5.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 2024139
(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)))