
(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 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (cbrt x)))
double code(double x) {
return cbrt((x + 1.0)) - cbrt(x);
}
public static double code(double x) {
return Math.cbrt((x + 1.0)) - Math.cbrt(x);
}
function code(x) return Float64(cbrt(Float64(x + 1.0)) - cbrt(x)) end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{x + 1} - \sqrt[3]{x}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (+ (cbrt x) t_0)))
(if (<= (- t_0 (cbrt x)) 0.0)
(/ 1.0 (fma (cbrt x) t_1 (pow (cbrt x) 2.0)))
(/ 1.0 (fma (cbrt x) t_1 (exp (* 0.6666666666666666 (log1p x))))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double t_1 = cbrt(x) + t_0;
double tmp;
if ((t_0 - cbrt(x)) <= 0.0) {
tmp = 1.0 / fma(cbrt(x), t_1, pow(cbrt(x), 2.0));
} else {
tmp = 1.0 / fma(cbrt(x), t_1, exp((0.6666666666666666 * log1p(x))));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) t_1 = Float64(cbrt(x) + t_0) tmp = 0.0 if (Float64(t_0 - cbrt(x)) <= 0.0) tmp = Float64(1.0 / fma(cbrt(x), t_1, (cbrt(x) ^ 2.0))); else tmp = Float64(1.0 / fma(cbrt(x), t_1, exp(Float64(0.6666666666666666 * log1p(x))))); 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[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision]}, If[LessEqual[N[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], 0.0], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$1 + N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$1 + N[Exp[N[(0.6666666666666666 * N[Log[1 + x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
t_1 := \sqrt[3]{x} + t\_0\\
\mathbf{if}\;t\_0 - \sqrt[3]{x} \leq 0:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t\_1, {\left(\sqrt[3]{x}\right)}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t\_1, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)}\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x #s(literal 1 binary64))) (cbrt.f64 x)) < 0.0Initial program 4.2%
flip3--4.2%
div-inv4.2%
rem-cube-cbrt3.5%
rem-cube-cbrt4.2%
+-commutative4.2%
distribute-rgt-out4.2%
+-commutative4.2%
fma-define4.2%
add-exp-log4.2%
Applied egg-rr4.2%
associate-*r/4.2%
*-rgt-identity4.2%
+-commutative4.2%
associate--l+93.0%
+-inverses93.0%
metadata-eval93.0%
+-commutative93.0%
exp-prod92.1%
Simplified92.1%
Taylor expanded in x around inf 50.5%
unpow250.5%
cbrt-prod98.6%
*-un-lft-identity98.6%
pow298.6%
Applied egg-rr98.6%
*-lft-identity98.6%
Simplified98.6%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x #s(literal 1 binary64))) (cbrt.f64 x)) Initial program 74.4%
flip3--74.2%
div-inv74.2%
rem-cube-cbrt74.8%
rem-cube-cbrt97.8%
+-commutative97.8%
distribute-rgt-out98.0%
+-commutative98.0%
fma-define98.0%
add-exp-log98.6%
Applied egg-rr98.6%
associate-*r/98.6%
*-rgt-identity98.6%
+-commutative98.6%
associate--l+99.1%
+-inverses99.1%
metadata-eval99.1%
+-commutative99.1%
exp-prod98.2%
Simplified98.2%
pow-exp99.1%
Applied egg-rr99.1%
Final simplification98.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (+ (cbrt x) t_0)))
(if (<= (- t_0 (cbrt x)) 0.0)
(/ 1.0 (fma (cbrt x) t_1 (pow (cbrt x) 2.0)))
(/ 1.0 (fma (cbrt x) t_1 (pow (+ 1.0 x) 0.6666666666666666))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double t_1 = cbrt(x) + t_0;
double tmp;
if ((t_0 - cbrt(x)) <= 0.0) {
tmp = 1.0 / fma(cbrt(x), t_1, pow(cbrt(x), 2.0));
} else {
tmp = 1.0 / fma(cbrt(x), t_1, pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) t_1 = Float64(cbrt(x) + t_0) tmp = 0.0 if (Float64(t_0 - cbrt(x)) <= 0.0) tmp = Float64(1.0 / fma(cbrt(x), t_1, (cbrt(x) ^ 2.0))); else tmp = Float64(1.0 / fma(cbrt(x), t_1, (Float64(1.0 + x) ^ 0.6666666666666666))); 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[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision]}, If[LessEqual[N[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], 0.0], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$1 + N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$1 + N[Power[N[(1.0 + x), $MachinePrecision], 0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
t_1 := \sqrt[3]{x} + t\_0\\
\mathbf{if}\;t\_0 - \sqrt[3]{x} \leq 0:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t\_1, {\left(\sqrt[3]{x}\right)}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t\_1, {\left(1 + x\right)}^{0.6666666666666666}\right)}\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x #s(literal 1 binary64))) (cbrt.f64 x)) < 0.0Initial program 4.2%
flip3--4.2%
div-inv4.2%
rem-cube-cbrt3.5%
rem-cube-cbrt4.2%
+-commutative4.2%
distribute-rgt-out4.2%
+-commutative4.2%
fma-define4.2%
add-exp-log4.2%
Applied egg-rr4.2%
associate-*r/4.2%
*-rgt-identity4.2%
+-commutative4.2%
associate--l+93.0%
+-inverses93.0%
metadata-eval93.0%
+-commutative93.0%
exp-prod92.1%
Simplified92.1%
Taylor expanded in x around inf 50.5%
unpow250.5%
cbrt-prod98.6%
*-un-lft-identity98.6%
pow298.6%
Applied egg-rr98.6%
*-lft-identity98.6%
Simplified98.6%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x #s(literal 1 binary64))) (cbrt.f64 x)) Initial program 74.4%
flip3--74.2%
div-inv74.2%
rem-cube-cbrt74.8%
rem-cube-cbrt97.8%
+-commutative97.8%
distribute-rgt-out98.0%
+-commutative98.0%
fma-define98.0%
add-exp-log98.6%
Applied egg-rr98.6%
associate-*r/98.6%
*-rgt-identity98.6%
+-commutative98.6%
associate--l+99.1%
+-inverses99.1%
metadata-eval99.1%
+-commutative99.1%
exp-prod98.2%
Simplified98.2%
pow-exp99.1%
*-commutative99.1%
log1p-undefine99.1%
+-commutative99.1%
exp-to-pow98.8%
metadata-eval98.8%
pow-sqr98.7%
pow1/399.0%
pow1/398.5%
Applied egg-rr98.5%
pow298.5%
pow1/398.7%
+-commutative98.7%
pow-pow98.8%
+-commutative98.8%
metadata-eval98.8%
Applied egg-rr98.8%
Final simplification98.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (+ (cbrt x) t_0)))
(if (<= (- t_0 (cbrt x)) 0.0)
(/ 1.0 (* (cbrt x) (+ (cbrt x) t_1)))
(/ 1.0 (fma (cbrt x) t_1 (pow (+ 1.0 x) 0.6666666666666666))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double t_1 = cbrt(x) + t_0;
double tmp;
if ((t_0 - cbrt(x)) <= 0.0) {
tmp = 1.0 / (cbrt(x) * (cbrt(x) + t_1));
} else {
tmp = 1.0 / fma(cbrt(x), t_1, pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) t_1 = Float64(cbrt(x) + t_0) tmp = 0.0 if (Float64(t_0 - cbrt(x)) <= 0.0) tmp = Float64(1.0 / Float64(cbrt(x) * Float64(cbrt(x) + t_1))); else tmp = Float64(1.0 / fma(cbrt(x), t_1, (Float64(1.0 + x) ^ 0.6666666666666666))); 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[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision]}, If[LessEqual[N[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], 0.0], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$1 + N[Power[N[(1.0 + x), $MachinePrecision], 0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
t_1 := \sqrt[3]{x} + t\_0\\
\mathbf{if}\;t\_0 - \sqrt[3]{x} \leq 0:\\
\;\;\;\;\frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + t\_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t\_1, {\left(1 + x\right)}^{0.6666666666666666}\right)}\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x #s(literal 1 binary64))) (cbrt.f64 x)) < 0.0Initial program 4.2%
flip3--4.2%
div-inv4.2%
rem-cube-cbrt3.5%
rem-cube-cbrt4.2%
+-commutative4.2%
distribute-rgt-out4.2%
+-commutative4.2%
fma-define4.2%
add-exp-log4.2%
Applied egg-rr4.2%
associate-*r/4.2%
*-rgt-identity4.2%
+-commutative4.2%
associate--l+93.0%
+-inverses93.0%
metadata-eval93.0%
+-commutative93.0%
exp-prod92.1%
Simplified92.1%
Taylor expanded in x around inf 50.5%
fma-undefine50.5%
unpow250.5%
cbrt-prod98.5%
+-commutative98.5%
+-commutative98.5%
distribute-rgt-in98.5%
+-commutative98.5%
pow298.5%
+-commutative98.5%
distribute-rgt-in98.5%
Applied egg-rr98.5%
unpow298.5%
distribute-lft-out98.6%
+-commutative98.6%
+-commutative98.6%
Simplified98.6%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x #s(literal 1 binary64))) (cbrt.f64 x)) Initial program 74.4%
flip3--74.2%
div-inv74.2%
rem-cube-cbrt74.8%
rem-cube-cbrt97.8%
+-commutative97.8%
distribute-rgt-out98.0%
+-commutative98.0%
fma-define98.0%
add-exp-log98.6%
Applied egg-rr98.6%
associate-*r/98.6%
*-rgt-identity98.6%
+-commutative98.6%
associate--l+99.1%
+-inverses99.1%
metadata-eval99.1%
+-commutative99.1%
exp-prod98.2%
Simplified98.2%
pow-exp99.1%
*-commutative99.1%
log1p-undefine99.1%
+-commutative99.1%
exp-to-pow98.8%
metadata-eval98.8%
pow-sqr98.7%
pow1/399.0%
pow1/398.5%
Applied egg-rr98.5%
pow298.5%
pow1/398.7%
+-commutative98.7%
pow-pow98.8%
+-commutative98.8%
metadata-eval98.8%
Applied egg-rr98.8%
Final simplification98.6%
(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.7%
flip3--6.7%
div-inv6.7%
rem-cube-cbrt6.0%
rem-cube-cbrt7.5%
+-commutative7.5%
distribute-rgt-out7.5%
+-commutative7.5%
fma-define7.5%
add-exp-log7.5%
Applied egg-rr7.5%
associate-*r/7.5%
*-rgt-identity7.5%
+-commutative7.5%
associate--l+93.2%
+-inverses93.2%
metadata-eval93.2%
+-commutative93.2%
exp-prod92.3%
Simplified92.3%
pow-exp93.2%
*-commutative93.2%
log1p-undefine93.2%
+-commutative93.2%
exp-to-pow92.9%
metadata-eval92.9%
pow-sqr92.9%
pow1/394.4%
pow1/398.6%
Applied egg-rr98.6%
pow298.6%
Applied egg-rr98.6%
Final simplification98.6%
(FPCore (x) :precision binary64 (if (<= x 6.3e+161) (* 0.3333333333333333 (cbrt (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 <= 6.3e+161) {
tmp = 0.3333333333333333 * cbrt(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 <= 6.3e+161) tmp = Float64(0.3333333333333333 * cbrt((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, 6.3e+161], N[(0.3333333333333333 * N[Power[N[Power[x, -2.0], $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 6.3 \cdot 10^{+161}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt[3]{{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 < 6.3000000000000001e161Initial program 8.3%
add-exp-log8.3%
Applied egg-rr8.3%
Taylor expanded in x around inf 90.3%
exp-to-pow85.2%
*-commutative85.2%
rec-exp88.9%
*-commutative88.9%
distribute-rgt-neg-in88.9%
metadata-eval88.9%
exp-to-pow93.9%
Simplified93.9%
if 6.3000000000000001e161 < x Initial program 4.8%
flip3--4.8%
div-inv4.8%
rem-cube-cbrt3.0%
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+91.8%
+-inverses91.8%
metadata-eval91.8%
+-commutative91.8%
exp-prod91.1%
Simplified91.1%
Taylor expanded in x around 0 20.0%
Final simplification59.3%
(FPCore (x) :precision binary64 (/ 1.0 (* (cbrt x) (+ (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x)))))))
double code(double x) {
return 1.0 / (cbrt(x) * (cbrt(x) + (cbrt(x) + cbrt((1.0 + x)))));
}
public static double code(double x) {
return 1.0 / (Math.cbrt(x) * (Math.cbrt(x) + (Math.cbrt(x) + Math.cbrt((1.0 + x)))));
}
function code(x) return Float64(1.0 / Float64(cbrt(x) * Float64(cbrt(x) + Float64(cbrt(x) + cbrt(Float64(1.0 + x)))))) end
code[x_] := N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * 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]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right)\right)}
\end{array}
Initial program 6.7%
flip3--6.7%
div-inv6.7%
rem-cube-cbrt6.0%
rem-cube-cbrt7.5%
+-commutative7.5%
distribute-rgt-out7.5%
+-commutative7.5%
fma-define7.5%
add-exp-log7.5%
Applied egg-rr7.5%
associate-*r/7.5%
*-rgt-identity7.5%
+-commutative7.5%
associate--l+93.2%
+-inverses93.2%
metadata-eval93.2%
+-commutative93.2%
exp-prod92.3%
Simplified92.3%
Taylor expanded in x around inf 50.3%
fma-undefine50.3%
unpow250.3%
cbrt-prod96.7%
+-commutative96.7%
+-commutative96.7%
distribute-rgt-in96.7%
+-commutative96.7%
pow296.7%
+-commutative96.7%
distribute-rgt-in96.7%
Applied egg-rr96.7%
unpow296.7%
distribute-lft-out96.7%
+-commutative96.7%
+-commutative96.7%
Simplified96.7%
Final simplification96.7%
(FPCore (x) :precision binary64 (* 0.3333333333333333 (cbrt (pow x -2.0))))
double code(double x) {
return 0.3333333333333333 * cbrt(pow(x, -2.0));
}
public static double code(double x) {
return 0.3333333333333333 * Math.cbrt(Math.pow(x, -2.0));
}
function code(x) return Float64(0.3333333333333333 * cbrt((x ^ -2.0))) end
code[x_] := N[(0.3333333333333333 * N[Power[N[Power[x, -2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.3333333333333333 \cdot \sqrt[3]{{x}^{-2}}
\end{array}
Initial program 6.7%
add-exp-log6.7%
Applied egg-rr6.7%
Taylor expanded in x around inf 50.2%
exp-to-pow47.5%
*-commutative47.5%
rec-exp49.5%
*-commutative49.5%
distribute-rgt-neg-in49.5%
metadata-eval49.5%
exp-to-pow52.1%
Simplified52.1%
Final simplification52.1%
(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.7%
Taylor expanded in x around 0 1.8%
sub-neg1.8%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt5.3%
fabs-neg5.3%
unpow1/35.3%
metadata-eval5.3%
pow-sqr5.3%
fabs-sqr5.3%
pow-sqr5.3%
metadata-eval5.3%
unpow1/35.3%
Simplified5.3%
Final simplification5.3%
(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 2024095
(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)))