
(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 11 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))))
(if (<= (- t_0 (cbrt x)) 0.0)
(/ 1.0 (fma (cbrt x) (+ (cbrt x) (cbrt x)) (pow t_0 2.0)))
(/ 1.0 (fma (cbrt x) (+ (cbrt x) t_0) (cbrt (pow (+ 1.0 x) 2.0)))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double tmp;
if ((t_0 - cbrt(x)) <= 0.0) {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + cbrt(x)), pow(t_0, 2.0));
} else {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + t_0), cbrt(pow((1.0 + x), 2.0)));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) tmp = 0.0 if (Float64(t_0 - cbrt(x)) <= 0.0) tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(x)), (t_0 ^ 2.0))); else tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), cbrt((Float64(1.0 + x) ^ 2.0)))); end return tmp end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $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] + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision] + N[Power[N[Power[N[(1.0 + x), $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\mathbf{if}\;t_0 - \sqrt[3]{x} \leq 0:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{x}, {t_0}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, \sqrt[3]{{\left(1 + x\right)}^{2}}\right)}\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 0.0Initial program 4.3%
flip3--4.3%
div-inv4.3%
rem-cube-cbrt3.9%
rem-cube-cbrt4.3%
+-commutative4.3%
distribute-rgt-out4.3%
+-commutative4.3%
fma-def4.3%
add-exp-log4.3%
Applied egg-rr2.2%
associate-*r/2.2%
*-rgt-identity2.2%
+-commutative2.2%
associate--l+49.9%
+-inverses49.9%
metadata-eval49.9%
+-commutative49.9%
exp-prod49.4%
Simplified49.4%
metadata-eval49.4%
prod-exp49.4%
pow-prod-down50.1%
pow250.1%
pow-exp49.9%
log1p-udef49.9%
+-commutative49.9%
log-pow50.0%
add-exp-log49.8%
pow1/398.4%
pow298.4%
Applied egg-rr98.4%
unpow298.4%
+-commutative98.4%
Simplified98.4%
+-commutative98.4%
add-cube-cbrt98.3%
pow398.3%
Applied egg-rr98.3%
Taylor expanded in x around inf 50.6%
unpow1/398.4%
Simplified98.4%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 98.2%
flip3--98.1%
div-inv98.1%
rem-cube-cbrt98.4%
rem-cube-cbrt99.8%
+-commutative99.8%
distribute-rgt-out99.8%
+-commutative99.8%
fma-def99.8%
add-exp-log99.8%
Applied egg-rr98.3%
associate-*r/98.3%
*-rgt-identity98.3%
+-commutative98.3%
associate--l+98.3%
+-inverses98.3%
metadata-eval98.3%
+-commutative98.3%
exp-prod98.3%
Simplified98.3%
metadata-eval98.3%
prod-exp98.3%
pow-prod-down98.3%
pow298.3%
pow-exp98.3%
log1p-udef98.3%
+-commutative98.3%
log-pow98.3%
add-exp-log98.3%
pow1/399.8%
pow299.8%
cbrt-unprod99.9%
pow299.9%
Applied egg-rr99.9%
Final simplification99.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(if (<= (- t_0 (cbrt x)) 4e-6)
(/ 1.0 (fma (cbrt x) (+ (cbrt x) (cbrt x)) (pow t_0 2.0)))
(-
(* (cbrt (+ 1.0 (pow x 3.0))) (cbrt (/ 1.0 (- (fma x x 1.0) x))))
(cbrt x)))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double tmp;
if ((t_0 - cbrt(x)) <= 4e-6) {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + cbrt(x)), pow(t_0, 2.0));
} else {
tmp = (cbrt((1.0 + pow(x, 3.0))) * cbrt((1.0 / (fma(x, x, 1.0) - x)))) - cbrt(x);
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) tmp = 0.0 if (Float64(t_0 - cbrt(x)) <= 4e-6) tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(x)), (t_0 ^ 2.0))); else tmp = Float64(Float64(cbrt(Float64(1.0 + (x ^ 3.0))) * cbrt(Float64(1.0 / Float64(fma(x, x, 1.0) - x)))) - cbrt(x)); end return tmp end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[N[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], 4e-6], 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[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(1.0 + N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(1.0 / N[(N[(x * x + 1.0), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\mathbf{if}\;t_0 - \sqrt[3]{x} \leq 4 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{x}, {t_0}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{1 + {x}^{3}} \cdot \sqrt[3]{\frac{1}{\mathsf{fma}\left(x, x, 1\right) - x}} - \sqrt[3]{x}\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 3.99999999999999982e-6Initial program 5.0%
flip3--5.0%
div-inv5.0%
rem-cube-cbrt4.7%
rem-cube-cbrt6.5%
+-commutative6.5%
distribute-rgt-out6.5%
+-commutative6.5%
fma-def6.5%
add-exp-log6.5%
Applied egg-rr4.5%
associate-*r/4.5%
*-rgt-identity4.5%
+-commutative4.5%
associate--l+51.0%
+-inverses51.0%
metadata-eval51.0%
+-commutative51.0%
exp-prod50.5%
Simplified50.5%
metadata-eval50.5%
prod-exp50.5%
pow-prod-down51.3%
pow251.3%
pow-exp51.0%
log1p-udef51.0%
+-commutative51.0%
log-pow51.1%
add-exp-log50.9%
pow1/398.4%
pow298.4%
Applied egg-rr98.4%
unpow298.4%
+-commutative98.4%
Simplified98.4%
+-commutative98.4%
add-cube-cbrt98.3%
pow398.3%
Applied egg-rr98.3%
Taylor expanded in x around inf 51.3%
unpow1/398.0%
Simplified98.0%
if 3.99999999999999982e-6 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 99.6%
pow1/398.4%
flip3-+98.4%
div-inv98.4%
unpow-prod-down98.4%
pow398.4%
metadata-eval98.4%
+-commutative98.4%
pow398.4%
metadata-eval98.4%
*-rgt-identity98.4%
associate-+r-98.4%
fma-def98.4%
Applied egg-rr98.4%
unpow1/399.6%
unpow1/399.6%
Simplified99.6%
Final simplification98.8%
(FPCore (x)
:precision binary64
(if (<= (- (cbrt (+ 1.0 x)) (cbrt x)) 4e-6)
(+
(* (cbrt (/ 1.0 (pow x 5.0))) -0.1111111111111111)
(* 0.3333333333333333 (cbrt (/ 1.0 (pow x 2.0)))))
(-
(* (cbrt (+ 1.0 (pow x 3.0))) (cbrt (/ 1.0 (- (fma x x 1.0) x))))
(cbrt x))))
double code(double x) {
double tmp;
if ((cbrt((1.0 + x)) - cbrt(x)) <= 4e-6) {
tmp = (cbrt((1.0 / pow(x, 5.0))) * -0.1111111111111111) + (0.3333333333333333 * cbrt((1.0 / pow(x, 2.0))));
} else {
tmp = (cbrt((1.0 + pow(x, 3.0))) * cbrt((1.0 / (fma(x, x, 1.0) - x)))) - cbrt(x);
}
return tmp;
}
function code(x) tmp = 0.0 if (Float64(cbrt(Float64(1.0 + x)) - cbrt(x)) <= 4e-6) tmp = Float64(Float64(cbrt(Float64(1.0 / (x ^ 5.0))) * -0.1111111111111111) + Float64(0.3333333333333333 * cbrt(Float64(1.0 / (x ^ 2.0))))); else tmp = Float64(Float64(cbrt(Float64(1.0 + (x ^ 3.0))) * cbrt(Float64(1.0 / Float64(fma(x, x, 1.0) - x)))) - cbrt(x)); end return tmp end
code[x_] := If[LessEqual[N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], 4e-6], N[(N[(N[Power[N[(1.0 / N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * -0.1111111111111111), $MachinePrecision] + N[(0.3333333333333333 * N[Power[N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(1.0 + N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(1.0 / N[(N[(x * x + 1.0), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sqrt[3]{1 + x} - \sqrt[3]{x} \leq 4 \cdot 10^{-6}:\\
\;\;\;\;\sqrt[3]{\frac{1}{{x}^{5}}} \cdot -0.1111111111111111 + 0.3333333333333333 \cdot \sqrt[3]{\frac{1}{{x}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{1 + {x}^{3}} \cdot \sqrt[3]{\frac{1}{\mathsf{fma}\left(x, x, 1\right) - x}} - \sqrt[3]{x}\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 3.99999999999999982e-6Initial program 5.0%
add-sqr-sqrt3.0%
add-sqr-sqrt3.0%
difference-of-squares3.1%
pow1/33.1%
sqrt-pow13.1%
metadata-eval3.1%
pow1/33.1%
sqrt-pow13.1%
metadata-eval3.1%
pow1/31.7%
sqrt-pow11.7%
metadata-eval1.7%
pow1/32.9%
sqrt-pow13.0%
metadata-eval3.0%
Applied egg-rr3.0%
Taylor expanded in x around inf 43.9%
associate-+r+43.9%
distribute-rgt-out43.9%
unpow1/346.1%
metadata-eval46.1%
unpow1/349.5%
Simplified49.5%
if 3.99999999999999982e-6 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 99.6%
pow1/398.4%
flip3-+98.4%
div-inv98.4%
unpow-prod-down98.4%
pow398.4%
metadata-eval98.4%
+-commutative98.4%
pow398.4%
metadata-eval98.4%
*-rgt-identity98.4%
associate-+r-98.4%
fma-def98.4%
Applied egg-rr98.4%
unpow1/399.6%
unpow1/399.6%
Simplified99.6%
Final simplification75.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (- (cbrt (+ 1.0 x)) (cbrt x))))
(if (<= t_0 4e-6)
(+
(* (cbrt (/ 1.0 (pow x 5.0))) -0.1111111111111111)
(* 0.3333333333333333 (cbrt (/ 1.0 (pow x 2.0)))))
t_0)))
double code(double x) {
double t_0 = cbrt((1.0 + x)) - cbrt(x);
double tmp;
if (t_0 <= 4e-6) {
tmp = (cbrt((1.0 / pow(x, 5.0))) * -0.1111111111111111) + (0.3333333333333333 * cbrt((1.0 / pow(x, 2.0))));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x)) - Math.cbrt(x);
double tmp;
if (t_0 <= 4e-6) {
tmp = (Math.cbrt((1.0 / Math.pow(x, 5.0))) * -0.1111111111111111) + (0.3333333333333333 * Math.cbrt((1.0 / Math.pow(x, 2.0))));
} else {
tmp = t_0;
}
return tmp;
}
function code(x) t_0 = Float64(cbrt(Float64(1.0 + x)) - cbrt(x)) tmp = 0.0 if (t_0 <= 4e-6) tmp = Float64(Float64(cbrt(Float64(1.0 / (x ^ 5.0))) * -0.1111111111111111) + Float64(0.3333333333333333 * cbrt(Float64(1.0 / (x ^ 2.0))))); else tmp = t_0; end return tmp end
code[x_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 4e-6], N[(N[(N[Power[N[(1.0 / N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * -0.1111111111111111), $MachinePrecision] + N[(0.3333333333333333 * N[Power[N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x} - \sqrt[3]{x}\\
\mathbf{if}\;t_0 \leq 4 \cdot 10^{-6}:\\
\;\;\;\;\sqrt[3]{\frac{1}{{x}^{5}}} \cdot -0.1111111111111111 + 0.3333333333333333 \cdot \sqrt[3]{\frac{1}{{x}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 3.99999999999999982e-6Initial program 5.0%
add-sqr-sqrt3.0%
add-sqr-sqrt3.0%
difference-of-squares3.1%
pow1/33.1%
sqrt-pow13.1%
metadata-eval3.1%
pow1/33.1%
sqrt-pow13.1%
metadata-eval3.1%
pow1/31.7%
sqrt-pow11.7%
metadata-eval1.7%
pow1/32.9%
sqrt-pow13.0%
metadata-eval3.0%
Applied egg-rr3.0%
Taylor expanded in x around inf 43.9%
associate-+r+43.9%
distribute-rgt-out43.9%
unpow1/346.1%
metadata-eval46.1%
unpow1/349.5%
Simplified49.5%
if 3.99999999999999982e-6 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 99.6%
Final simplification75.0%
(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 53.1%
flip3--53.0%
div-inv53.0%
rem-cube-cbrt53.0%
rem-cube-cbrt53.9%
+-commutative53.9%
distribute-rgt-out53.9%
+-commutative53.9%
fma-def53.9%
add-exp-log53.9%
Applied egg-rr52.1%
associate-*r/52.1%
*-rgt-identity52.1%
+-commutative52.1%
associate--l+75.1%
+-inverses75.1%
metadata-eval75.1%
+-commutative75.1%
exp-prod74.8%
Simplified74.8%
metadata-eval74.8%
prod-exp74.8%
pow-prod-down75.2%
pow275.2%
pow-exp75.1%
log1p-udef75.1%
+-commutative75.1%
log-pow75.1%
add-exp-log75.0%
pow1/399.1%
pow299.1%
Applied egg-rr99.1%
unpow299.1%
+-commutative99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (x) :precision binary64 (let* ((t_0 (- (cbrt (+ 1.0 x)) (cbrt x)))) (if (<= t_0 4e-6) (* 0.3333333333333333 (cbrt (/ 1.0 (pow x 2.0)))) t_0)))
double code(double x) {
double t_0 = cbrt((1.0 + x)) - cbrt(x);
double tmp;
if (t_0 <= 4e-6) {
tmp = 0.3333333333333333 * cbrt((1.0 / pow(x, 2.0)));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x)) - Math.cbrt(x);
double tmp;
if (t_0 <= 4e-6) {
tmp = 0.3333333333333333 * Math.cbrt((1.0 / Math.pow(x, 2.0)));
} else {
tmp = t_0;
}
return tmp;
}
function code(x) t_0 = Float64(cbrt(Float64(1.0 + x)) - cbrt(x)) tmp = 0.0 if (t_0 <= 4e-6) tmp = Float64(0.3333333333333333 * cbrt(Float64(1.0 / (x ^ 2.0)))); else tmp = t_0; end return tmp end
code[x_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 4e-6], N[(0.3333333333333333 * N[Power[N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x} - \sqrt[3]{x}\\
\mathbf{if}\;t_0 \leq 4 \cdot 10^{-6}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt[3]{\frac{1}{{x}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 3.99999999999999982e-6Initial program 5.0%
add-sqr-sqrt3.0%
add-sqr-sqrt3.0%
difference-of-squares3.1%
pow1/33.1%
sqrt-pow13.1%
metadata-eval3.1%
pow1/33.1%
sqrt-pow13.1%
metadata-eval3.1%
pow1/31.7%
sqrt-pow11.7%
metadata-eval1.7%
pow1/32.9%
sqrt-pow13.0%
metadata-eval3.0%
Applied egg-rr3.0%
Taylor expanded in x around inf 45.7%
unpow1/349.1%
Simplified49.1%
if 3.99999999999999982e-6 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 99.6%
Final simplification74.7%
(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 53.1%
Final simplification53.1%
(FPCore (x) :precision binary64 (+ 1.0 (- (* x 0.3333333333333333) (cbrt x))))
double code(double x) {
return 1.0 + ((x * 0.3333333333333333) - cbrt(x));
}
public static double code(double x) {
return 1.0 + ((x * 0.3333333333333333) - Math.cbrt(x));
}
function code(x) return Float64(1.0 + Float64(Float64(x * 0.3333333333333333) - cbrt(x))) end
code[x_] := N[(1.0 + N[(N[(x * 0.3333333333333333), $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \left(x \cdot 0.3333333333333333 - \sqrt[3]{x}\right)
\end{array}
Initial program 53.1%
add-cube-cbrt52.6%
pow352.6%
Applied egg-rr52.6%
Taylor expanded in x around 0 29.0%
associate--l+29.0%
*-commutative29.0%
metadata-eval29.0%
pow-base-129.0%
unpow1/350.4%
*-lft-identity50.4%
Simplified50.4%
Final simplification50.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 53.1%
add-cube-cbrt52.6%
pow352.6%
Applied egg-rr52.6%
Taylor expanded in x around 0 28.0%
metadata-eval28.0%
pow-base-128.0%
unpow1/350.0%
*-lft-identity50.0%
Simplified50.0%
Final simplification50.0%
(FPCore (x) :precision binary64 0.0)
double code(double x) {
return 0.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 0.0d0
end function
public static double code(double x) {
return 0.0;
}
def code(x): return 0.0
function code(x) return 0.0 end
function tmp = code(x) tmp = 0.0; end
code[x_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 53.1%
Taylor expanded in x around inf 3.7%
Final simplification3.7%
(FPCore (x) :precision binary64 1.0)
double code(double x) {
return 1.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0
end function
public static double code(double x) {
return 1.0;
}
def code(x): return 1.0
function code(x) return 1.0 end
function tmp = code(x) tmp = 1.0; end
code[x_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 53.1%
Taylor expanded in x around 0 48.9%
Final simplification48.9%
herbie shell --seed 2024019
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
(- (cbrt (+ x 1.0)) (cbrt x)))