
(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 13 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 (pow t_0 2.0)))
(/
1.0
(+
t_1
(/ (+ x (+ 1.0 x)) (/ (+ t_1 (* (cbrt x) (- (cbrt x) t_0))) (cbrt x)))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double t_1 = pow(t_0, 2.0);
return 1.0 / (t_1 + ((x + (1.0 + x)) / ((t_1 + (cbrt(x) * (cbrt(x) - t_0))) / cbrt(x))));
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
double t_1 = Math.pow(t_0, 2.0);
return 1.0 / (t_1 + ((x + (1.0 + x)) / ((t_1 + (Math.cbrt(x) * (Math.cbrt(x) - t_0))) / Math.cbrt(x))));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) t_1 = t_0 ^ 2.0 return Float64(1.0 / Float64(t_1 + Float64(Float64(x + Float64(1.0 + x)) / Float64(Float64(t_1 + Float64(cbrt(x) * Float64(cbrt(x) - t_0))) / cbrt(x))))) end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$1 = N[Power[t$95$0, 2.0], $MachinePrecision]}, N[(1.0 / N[(t$95$1 + N[(N[(x + N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$1 + N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
t_1 := {t_0}^{2}\\
\frac{1}{t_1 + \frac{x + \left(1 + x\right)}{\frac{t_1 + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} - t_0\right)}{\sqrt[3]{x}}}}
\end{array}
\end{array}
Initial program 54.7%
flip3--54.6%
div-inv54.6%
rem-cube-cbrt54.7%
+-commutative54.7%
rem-cube-cbrt56.1%
associate--l+99.2%
Applied egg-rr74.8%
+-inverses74.8%
metadata-eval74.8%
*-lft-identity74.8%
+-commutative74.8%
Simplified74.8%
log1p-udef74.8%
+-commutative74.8%
exp-to-pow74.8%
metadata-eval74.8%
pow-sqr74.8%
pow1/375.2%
pow1/399.2%
pow299.2%
Applied egg-rr99.2%
*-commutative99.2%
flip3-+99.2%
associate-*l/89.0%
associate-/l*99.2%
+-commutative99.2%
rem-cube-cbrt99.4%
rem-cube-cbrt99.7%
+-commutative99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (pow t_0 2.0)))
(/
1.0
(+
t_1
(* (cbrt x) (/ (+ 1.0 (+ x x)) (+ t_1 (* (cbrt x) (- (cbrt x) t_0)))))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double t_1 = pow(t_0, 2.0);
return 1.0 / (t_1 + (cbrt(x) * ((1.0 + (x + x)) / (t_1 + (cbrt(x) * (cbrt(x) - t_0))))));
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
double t_1 = Math.pow(t_0, 2.0);
return 1.0 / (t_1 + (Math.cbrt(x) * ((1.0 + (x + x)) / (t_1 + (Math.cbrt(x) * (Math.cbrt(x) - t_0))))));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) t_1 = t_0 ^ 2.0 return Float64(1.0 / Float64(t_1 + Float64(cbrt(x) * Float64(Float64(1.0 + Float64(x + x)) / Float64(t_1 + Float64(cbrt(x) * Float64(cbrt(x) - t_0))))))) end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$1 = N[Power[t$95$0, 2.0], $MachinePrecision]}, N[(1.0 / N[(t$95$1 + N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[(1.0 + N[(x + x), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 + N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
t_1 := {t_0}^{2}\\
\frac{1}{t_1 + \sqrt[3]{x} \cdot \frac{1 + \left(x + x\right)}{t_1 + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} - t_0\right)}}
\end{array}
\end{array}
Initial program 54.7%
flip3--54.6%
div-inv54.6%
rem-cube-cbrt54.7%
+-commutative54.7%
rem-cube-cbrt56.1%
associate--l+99.2%
Applied egg-rr74.8%
+-inverses74.8%
metadata-eval74.8%
*-lft-identity74.8%
+-commutative74.8%
Simplified74.8%
log1p-udef74.8%
+-commutative74.8%
exp-to-pow74.8%
metadata-eval74.8%
pow-sqr74.8%
pow1/375.2%
pow1/399.2%
pow299.2%
Applied egg-rr99.2%
*-commutative99.2%
flip3-+99.2%
associate-*l/89.0%
associate-/l*99.2%
+-commutative99.2%
rem-cube-cbrt99.4%
rem-cube-cbrt99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-/r/99.7%
associate-+r+99.7%
+-commutative99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(if (<= (- t_0 (cbrt x)) 0.0)
(/ 1.0 (+ 1.0 (* (cbrt x) (+ t_0 (cbrt x)))))
(- (/ (cbrt (fma x x -1.0)) (cbrt (+ x -1.0))) (cbrt x)))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double tmp;
if ((t_0 - cbrt(x)) <= 0.0) {
tmp = 1.0 / (1.0 + (cbrt(x) * (t_0 + cbrt(x))));
} else {
tmp = (cbrt(fma(x, x, -1.0)) / cbrt((x + -1.0))) - cbrt(x);
}
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 / Float64(1.0 + Float64(cbrt(x) * Float64(t_0 + cbrt(x))))); else tmp = Float64(Float64(cbrt(fma(x, x, -1.0)) / cbrt(Float64(x + -1.0))) - 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], 0.0], N[(1.0 / N[(1.0 + N[(N[Power[x, 1/3], $MachinePrecision] * N[(t$95$0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(x * x + -1.0), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[N[(x + -1.0), $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 0:\\
\;\;\;\;\frac{1}{1 + \sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{\mathsf{fma}\left(x, x, -1\right)}}{\sqrt[3]{x + -1}} - \sqrt[3]{x}\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 0.0Initial program 4.2%
flip3--4.2%
div-inv4.2%
rem-cube-cbrt3.5%
+-commutative3.5%
rem-cube-cbrt4.2%
associate--l+98.4%
Applied egg-rr46.7%
+-inverses46.7%
metadata-eval46.7%
*-lft-identity46.7%
+-commutative46.7%
Simplified46.7%
Taylor expanded in x around 0 19.9%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 97.2%
flip-+97.2%
cbrt-div97.3%
div-inv97.2%
metadata-eval97.2%
fma-neg97.2%
metadata-eval97.2%
sub-neg97.2%
metadata-eval97.2%
Applied egg-rr97.2%
associate-*r/97.3%
*-rgt-identity97.3%
Simplified97.3%
Final simplification61.9%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(if (<= (- t_0 (cbrt x)) 1e-10)
(/ 1.0 (+ 1.0 (* (cbrt x) (+ t_0 (cbrt x)))))
(- t_0 (pow (cbrt (cbrt x)) 3.0)))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double tmp;
if ((t_0 - cbrt(x)) <= 1e-10) {
tmp = 1.0 / (1.0 + (cbrt(x) * (t_0 + cbrt(x))));
} else {
tmp = t_0 - pow(cbrt(cbrt(x)), 3.0);
}
return tmp;
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
double tmp;
if ((t_0 - Math.cbrt(x)) <= 1e-10) {
tmp = 1.0 / (1.0 + (Math.cbrt(x) * (t_0 + Math.cbrt(x))));
} else {
tmp = t_0 - Math.pow(Math.cbrt(Math.cbrt(x)), 3.0);
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) tmp = 0.0 if (Float64(t_0 - cbrt(x)) <= 1e-10) tmp = Float64(1.0 / Float64(1.0 + Float64(cbrt(x) * Float64(t_0 + cbrt(x))))); else tmp = Float64(t_0 - (cbrt(cbrt(x)) ^ 3.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], 1e-10], N[(1.0 / N[(1.0 + N[(N[Power[x, 1/3], $MachinePrecision] * N[(t$95$0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - N[Power[N[Power[N[Power[x, 1/3], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\mathbf{if}\;t_0 - \sqrt[3]{x} \leq 10^{-10}:\\
\;\;\;\;\frac{1}{1 + \sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 - {\left(\sqrt[3]{\sqrt[3]{x}}\right)}^{3}\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 1.00000000000000004e-10Initial program 4.3%
flip3--4.3%
div-inv4.3%
rem-cube-cbrt4.3%
+-commutative4.3%
rem-cube-cbrt5.0%
associate--l+98.4%
Applied egg-rr47.1%
+-inverses47.1%
metadata-eval47.1%
*-lft-identity47.1%
+-commutative47.1%
Simplified47.1%
Taylor expanded in x around 0 19.9%
if 1.00000000000000004e-10 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 97.7%
add-cube-cbrt97.8%
pow397.8%
Applied egg-rr97.8%
Final simplification61.9%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (cbrt x) (+ (cbrt (+ 1.0 x)) (cbrt x)))))
(if (<= x 1.35e+154)
(/ 1.0 (+ t_0 (cbrt (pow (+ 1.0 x) 2.0))))
(/ 1.0 (+ t_0 (pow (+ 1.0 x) 0.6666666666666666))))))
double code(double x) {
double t_0 = cbrt(x) * (cbrt((1.0 + x)) + cbrt(x));
double tmp;
if (x <= 1.35e+154) {
tmp = 1.0 / (t_0 + cbrt(pow((1.0 + x), 2.0)));
} else {
tmp = 1.0 / (t_0 + pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
public static double code(double x) {
double t_0 = Math.cbrt(x) * (Math.cbrt((1.0 + x)) + Math.cbrt(x));
double tmp;
if (x <= 1.35e+154) {
tmp = 1.0 / (t_0 + Math.cbrt(Math.pow((1.0 + x), 2.0)));
} else {
tmp = 1.0 / (t_0 + Math.pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
function code(x) t_0 = Float64(cbrt(x) * Float64(cbrt(Float64(1.0 + x)) + cbrt(x))) tmp = 0.0 if (x <= 1.35e+154) tmp = Float64(1.0 / Float64(t_0 + cbrt((Float64(1.0 + x) ^ 2.0)))); else tmp = Float64(1.0 / Float64(t_0 + (Float64(1.0 + x) ^ 0.6666666666666666))); end return tmp end
code[x_] := Block[{t$95$0 = N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.35e+154], N[(1.0 / N[(t$95$0 + N[Power[N[Power[N[(1.0 + x), $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$0 + N[Power[N[(1.0 + x), $MachinePrecision], 0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)\\
\mathbf{if}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{t_0 + \sqrt[3]{{\left(1 + x\right)}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_0 + {\left(1 + x\right)}^{0.6666666666666666}}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 62.3%
flip3--62.3%
div-inv62.3%
rem-cube-cbrt62.6%
+-commutative62.6%
rem-cube-cbrt64.0%
associate--l+99.3%
Applied egg-rr72.2%
+-inverses72.2%
metadata-eval72.2%
*-lft-identity72.2%
+-commutative72.2%
Simplified72.2%
log1p-udef72.2%
+-commutative72.2%
exp-to-pow72.2%
metadata-eval72.2%
pow-sqr72.2%
pow-prod-down88.0%
pow1/389.3%
pow289.3%
Applied egg-rr89.3%
if 1.35000000000000003e154 < x Initial program 4.7%
flip3--4.7%
div-inv4.7%
rem-cube-cbrt2.9%
+-commutative2.9%
rem-cube-cbrt4.7%
associate--l+98.4%
Applied egg-rr91.3%
+-inverses91.3%
metadata-eval91.3%
*-lft-identity91.3%
+-commutative91.3%
Simplified91.3%
log1p-udef91.3%
+-commutative91.3%
exp-to-pow91.6%
Applied egg-rr91.6%
Final simplification89.6%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (- t_0 (cbrt x)))) (if (<= t_1 0.0) (/ 1.0 (+ (pow t_0 2.0) (cbrt x))) t_1)))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double t_1 = t_0 - cbrt(x);
double tmp;
if (t_1 <= 0.0) {
tmp = 1.0 / (pow(t_0, 2.0) + cbrt(x));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
double t_1 = t_0 - Math.cbrt(x);
double tmp;
if (t_1 <= 0.0) {
tmp = 1.0 / (Math.pow(t_0, 2.0) + Math.cbrt(x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) t_1 = Float64(t_0 - cbrt(x)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(1.0 / Float64((t_0 ^ 2.0) + cbrt(x))); else tmp = t_1; 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[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(1.0 / N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
t_1 := t_0 - \sqrt[3]{x}\\
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;\frac{1}{{t_0}^{2} + \sqrt[3]{x}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 0.0Initial program 4.2%
flip3--4.2%
div-inv4.2%
rem-cube-cbrt3.5%
+-commutative3.5%
rem-cube-cbrt4.2%
associate--l+98.4%
Applied egg-rr46.7%
+-inverses46.7%
metadata-eval46.7%
*-lft-identity46.7%
+-commutative46.7%
Simplified46.7%
log1p-udef46.7%
+-commutative46.7%
exp-to-pow46.7%
metadata-eval46.7%
pow-sqr46.7%
pow1/347.5%
pow1/398.4%
pow298.4%
Applied egg-rr98.4%
add-cube-cbrt98.0%
pow398.1%
+-commutative98.1%
+-commutative98.1%
Applied egg-rr98.1%
Taylor expanded in x around 0 8.9%
metadata-eval8.9%
pow-base-18.9%
unpow1/317.7%
Simplified17.7%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 97.2%
Final simplification60.9%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (cbrt x) (+ (cbrt (+ 1.0 x)) (cbrt x)))))
(if (<= x -1.0)
(/ 1.0 (+ t_0 (cbrt (pow x 2.0))))
(/ 1.0 (+ t_0 (pow (+ 1.0 x) 0.6666666666666666))))))
double code(double x) {
double t_0 = cbrt(x) * (cbrt((1.0 + x)) + cbrt(x));
double tmp;
if (x <= -1.0) {
tmp = 1.0 / (t_0 + cbrt(pow(x, 2.0)));
} else {
tmp = 1.0 / (t_0 + pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
public static double code(double x) {
double t_0 = Math.cbrt(x) * (Math.cbrt((1.0 + x)) + Math.cbrt(x));
double tmp;
if (x <= -1.0) {
tmp = 1.0 / (t_0 + Math.cbrt(Math.pow(x, 2.0)));
} else {
tmp = 1.0 / (t_0 + Math.pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
function code(x) t_0 = Float64(cbrt(x) * Float64(cbrt(Float64(1.0 + x)) + cbrt(x))) tmp = 0.0 if (x <= -1.0) tmp = Float64(1.0 / Float64(t_0 + cbrt((x ^ 2.0)))); else tmp = Float64(1.0 / Float64(t_0 + (Float64(1.0 + x) ^ 0.6666666666666666))); end return tmp end
code[x_] := Block[{t$95$0 = N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.0], N[(1.0 / N[(t$95$0 + N[Power[N[Power[x, 2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$0 + N[Power[N[(1.0 + x), $MachinePrecision], 0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{1}{t_0 + \sqrt[3]{{x}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_0 + {\left(1 + x\right)}^{0.6666666666666666}}\\
\end{array}
\end{array}
if x < -1Initial program 6.3%
flip3--6.3%
div-inv6.3%
rem-cube-cbrt6.4%
+-commutative6.4%
rem-cube-cbrt7.2%
associate--l+98.2%
Applied egg-rr0.0%
+-inverses0.0%
metadata-eval0.0%
*-lft-identity0.0%
+-commutative0.0%
Simplified0.0%
Taylor expanded in x around inf 56.9%
unpow1/359.5%
Simplified59.5%
if -1 < x Initial program 69.5%
flip3--69.4%
div-inv69.4%
rem-cube-cbrt69.5%
+-commutative69.5%
rem-cube-cbrt71.1%
associate--l+99.5%
Applied egg-rr97.6%
+-inverses97.6%
metadata-eval97.6%
*-lft-identity97.6%
+-commutative97.6%
Simplified97.6%
log1p-udef97.6%
+-commutative97.6%
exp-to-pow97.7%
Applied egg-rr97.7%
Final simplification88.7%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x)))) (/ 1.0 (+ (pow t_0 2.0) (* (cbrt x) (+ t_0 (cbrt x)))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / (pow(t_0, 2.0) + (cbrt(x) * (t_0 + cbrt(x))));
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
return 1.0 / (Math.pow(t_0, 2.0) + (Math.cbrt(x) * (t_0 + Math.cbrt(x))));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / Float64((t_0 ^ 2.0) + Float64(cbrt(x) * Float64(t_0 + cbrt(x))))) end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, N[(1.0 / N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * N[(t$95$0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\frac{1}{{t_0}^{2} + \sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right)}
\end{array}
\end{array}
Initial program 54.7%
flip3--54.6%
div-inv54.6%
rem-cube-cbrt54.7%
+-commutative54.7%
rem-cube-cbrt56.1%
associate--l+99.2%
Applied egg-rr74.8%
+-inverses74.8%
metadata-eval74.8%
*-lft-identity74.8%
+-commutative74.8%
Simplified74.8%
log1p-udef74.8%
+-commutative74.8%
exp-to-pow74.8%
metadata-eval74.8%
pow-sqr74.8%
pow1/375.2%
pow1/399.2%
pow299.2%
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (cbrt x) (+ (cbrt (+ 1.0 x)) (cbrt x)))))
(if (<= x -1.0)
(/ 1.0 (+ 1.0 t_0))
(/ 1.0 (+ t_0 (pow (+ 1.0 x) 0.6666666666666666))))))
double code(double x) {
double t_0 = cbrt(x) * (cbrt((1.0 + x)) + cbrt(x));
double tmp;
if (x <= -1.0) {
tmp = 1.0 / (1.0 + t_0);
} else {
tmp = 1.0 / (t_0 + pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
public static double code(double x) {
double t_0 = Math.cbrt(x) * (Math.cbrt((1.0 + x)) + Math.cbrt(x));
double tmp;
if (x <= -1.0) {
tmp = 1.0 / (1.0 + t_0);
} else {
tmp = 1.0 / (t_0 + Math.pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
function code(x) t_0 = Float64(cbrt(x) * Float64(cbrt(Float64(1.0 + x)) + cbrt(x))) tmp = 0.0 if (x <= -1.0) tmp = Float64(1.0 / Float64(1.0 + t_0)); else tmp = Float64(1.0 / Float64(t_0 + (Float64(1.0 + x) ^ 0.6666666666666666))); end return tmp end
code[x_] := Block[{t$95$0 = N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.0], N[(1.0 / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$0 + N[Power[N[(1.0 + x), $MachinePrecision], 0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{1}{1 + t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_0 + {\left(1 + x\right)}^{0.6666666666666666}}\\
\end{array}
\end{array}
if x < -1Initial program 6.3%
flip3--6.3%
div-inv6.3%
rem-cube-cbrt6.4%
+-commutative6.4%
rem-cube-cbrt7.2%
associate--l+98.2%
Applied egg-rr0.0%
+-inverses0.0%
metadata-eval0.0%
*-lft-identity0.0%
+-commutative0.0%
Simplified0.0%
Taylor expanded in x around 0 19.9%
if -1 < x Initial program 69.5%
flip3--69.4%
div-inv69.4%
rem-cube-cbrt69.5%
+-commutative69.5%
rem-cube-cbrt71.1%
associate--l+99.5%
Applied egg-rr97.6%
+-inverses97.6%
metadata-eval97.6%
*-lft-identity97.6%
+-commutative97.6%
Simplified97.6%
log1p-udef97.6%
+-commutative97.6%
exp-to-pow97.7%
Applied egg-rr97.7%
Final simplification79.4%
(FPCore (x) :precision binary64 (/ 1.0 (+ 1.0 (* (cbrt x) (+ (cbrt (+ 1.0 x)) (cbrt x))))))
double code(double x) {
return 1.0 / (1.0 + (cbrt(x) * (cbrt((1.0 + x)) + cbrt(x))));
}
public static double code(double x) {
return 1.0 / (1.0 + (Math.cbrt(x) * (Math.cbrt((1.0 + x)) + Math.cbrt(x))));
}
function code(x) return Float64(1.0 / Float64(1.0 + Float64(cbrt(x) * Float64(cbrt(Float64(1.0 + x)) + cbrt(x))))) end
code[x_] := N[(1.0 / N[(1.0 + N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{1 + \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)}
\end{array}
Initial program 54.7%
flip3--54.6%
div-inv54.6%
rem-cube-cbrt54.7%
+-commutative54.7%
rem-cube-cbrt56.1%
associate--l+99.2%
Applied egg-rr74.8%
+-inverses74.8%
metadata-eval74.8%
*-lft-identity74.8%
+-commutative74.8%
Simplified74.8%
Taylor expanded in x around 0 60.3%
Final simplification60.3%
(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 54.7%
Final simplification54.7%
(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 54.7%
Taylor expanded in x around inf 3.6%
Final simplification3.6%
(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 54.7%
Taylor expanded in x around 0 52.0%
Final simplification52.0%
herbie shell --seed 2023301
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
(- (cbrt (+ x 1.0)) (cbrt x)))