
(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)))) (/ 1.0 (fma (+ t_0 (cbrt x)) (cbrt x) (pow t_0 2.0)))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / fma((t_0 + cbrt(x)), cbrt(x), pow(t_0, 2.0));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / fma(Float64(t_0 + cbrt(x)), cbrt(x), (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[(t$95$0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision] * N[Power[x, 1/3], $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(t_0 + \sqrt[3]{x}, \sqrt[3]{x}, {t_0}^{2}\right)}
\end{array}
\end{array}
Initial program 56.0%
flip3--56.0%
div-inv56.0%
rem-cube-cbrt56.3%
rem-cube-cbrt57.2%
cbrt-unprod57.2%
pow257.2%
distribute-rgt-out57.2%
+-commutative57.2%
Applied egg-rr57.2%
associate-*r/57.2%
*-rgt-identity57.2%
+-commutative57.2%
associate--l+77.7%
+-inverses77.7%
metadata-eval77.7%
+-commutative77.7%
fma-def77.7%
+-commutative77.7%
+-commutative77.7%
Simplified77.7%
add-log-exp55.3%
*-un-lft-identity55.3%
log-prod55.3%
metadata-eval55.3%
add-log-exp77.7%
fma-udef77.7%
pow1/338.4%
*-commutative38.4%
pow1/338.2%
unpow238.2%
pow-prod-down46.2%
+-commutative46.2%
pow1/346.3%
+-commutative46.3%
pow1/346.5%
Applied egg-rr99.2%
+-lft-identity99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (* (cbrt x) (+ t_0 (cbrt x)))))
(if (<= x -1.35e+154)
(/ 1.0 (+ 1.0 t_1))
(if (<= x 1.22e+154)
(/ 1.0 (+ (pow t_0 2.0) (+ (cbrt (* x (+ 1.0 x))) (cbrt (* x x)))))
(/ 1.0 (+ 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 + cbrt(x));
double tmp;
if (x <= -1.35e+154) {
tmp = 1.0 / (1.0 + t_1);
} else if (x <= 1.22e+154) {
tmp = 1.0 / (pow(t_0, 2.0) + (cbrt((x * (1.0 + x))) + cbrt((x * x))));
} else {
tmp = 1.0 / (t_1 + exp((0.6666666666666666 * log1p(x))));
}
return tmp;
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
double t_1 = Math.cbrt(x) * (t_0 + Math.cbrt(x));
double tmp;
if (x <= -1.35e+154) {
tmp = 1.0 / (1.0 + t_1);
} else if (x <= 1.22e+154) {
tmp = 1.0 / (Math.pow(t_0, 2.0) + (Math.cbrt((x * (1.0 + x))) + Math.cbrt((x * x))));
} else {
tmp = 1.0 / (t_1 + Math.exp((0.6666666666666666 * Math.log1p(x))));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) t_1 = Float64(cbrt(x) * Float64(t_0 + cbrt(x))) tmp = 0.0 if (x <= -1.35e+154) tmp = Float64(1.0 / Float64(1.0 + t_1)); elseif (x <= 1.22e+154) tmp = Float64(1.0 / Float64((t_0 ^ 2.0) + Float64(cbrt(Float64(x * Float64(1.0 + x))) + cbrt(Float64(x * x))))); else tmp = Float64(1.0 / Float64(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] * N[(t$95$0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.35e+154], N[(1.0 / N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.22e+154], N[(1.0 / N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[(N[Power[N[(x * N[(1.0 + x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(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} \cdot \left(t_0 + \sqrt[3]{x}\right)\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{1 + t_1}\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{{t_0}^{2} + \left(\sqrt[3]{x \cdot \left(1 + x\right)} + \sqrt[3]{x \cdot x}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_1 + e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}}\\
\end{array}
\end{array}
if x < -1.35000000000000003e154Initial program 4.6%
flip3--4.6%
div-inv4.6%
rem-cube-cbrt3.9%
rem-cube-cbrt4.6%
cbrt-unprod4.6%
pow24.6%
distribute-rgt-out4.6%
+-commutative4.6%
Applied egg-rr4.6%
associate-*r/4.6%
*-rgt-identity4.6%
+-commutative4.6%
associate--l+4.6%
+-inverses4.6%
metadata-eval4.6%
+-commutative4.6%
fma-def4.6%
+-commutative4.6%
+-commutative4.6%
Simplified4.6%
fma-udef4.6%
pow1/34.6%
unpow24.6%
pow-prod-down0.0%
+-commutative0.0%
pow1/30.0%
+-commutative0.0%
pow1/398.4%
+-commutative98.4%
pow298.4%
+-commutative98.4%
pow1/30.0%
*-commutative0.0%
pow1/398.4%
Applied egg-rr98.4%
Taylor expanded in x around 0 19.9%
if -1.35000000000000003e154 < x < 1.22e154Initial program 71.4%
flip3--71.4%
div-inv71.4%
rem-cube-cbrt72.1%
rem-cube-cbrt73.0%
cbrt-unprod73.0%
pow273.0%
distribute-rgt-out72.9%
+-commutative72.9%
Applied egg-rr72.9%
associate-*r/72.9%
*-rgt-identity72.9%
+-commutative72.9%
associate--l+99.5%
+-inverses99.5%
metadata-eval99.5%
+-commutative99.5%
fma-def99.5%
+-commutative99.5%
+-commutative99.5%
Simplified99.5%
fma-udef99.5%
pow1/398.2%
unpow298.2%
pow-prod-down82.8%
+-commutative82.8%
pow1/383.0%
+-commutative83.0%
pow1/399.5%
+-commutative99.5%
pow299.5%
+-commutative99.5%
pow1/349.3%
*-commutative49.3%
pow1/399.5%
Applied egg-rr99.5%
*-commutative99.5%
distribute-rgt-in99.4%
+-commutative99.4%
cbrt-unprod99.5%
+-commutative99.5%
cbrt-prod99.6%
Applied egg-rr99.6%
if 1.22e154 < x Initial program 4.8%
flip3--4.8%
div-inv4.8%
rem-cube-cbrt2.9%
rem-cube-cbrt4.8%
cbrt-unprod4.8%
pow24.8%
distribute-rgt-out4.8%
+-commutative4.8%
Applied egg-rr4.8%
associate-*r/4.8%
*-rgt-identity4.8%
+-commutative4.8%
associate--l+4.8%
+-inverses4.8%
metadata-eval4.8%
+-commutative4.8%
fma-def4.8%
+-commutative4.8%
+-commutative4.8%
Simplified4.8%
pow1/34.8%
pow-pow91.6%
metadata-eval91.6%
Applied egg-rr91.6%
fma-udef91.6%
+-commutative91.6%
add-exp-log92.4%
+-commutative92.4%
log-pow91.7%
+-commutative91.7%
log1p-udef91.7%
Applied egg-rr91.7%
Final simplification88.0%
(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)))))
(- (+ 1.0 (+ t_0 -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 = (1.0 + (t_0 + -1.0)) - cbrt(x);
}
return tmp;
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
double tmp;
if ((t_0 - Math.cbrt(x)) <= 0.0) {
tmp = 1.0 / (1.0 + (Math.cbrt(x) * (t_0 + Math.cbrt(x))));
} else {
tmp = (1.0 + (t_0 + -1.0)) - Math.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(1.0 + Float64(t_0 + -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[(1.0 + N[(t$95$0 + -1.0), $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}:\\
\;\;\;\;\left(1 + \left(t_0 + -1\right)\right) - \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-cbrt4.7%
rem-cube-cbrt5.0%
cbrt-unprod5.0%
pow25.0%
distribute-rgt-out5.0%
+-commutative5.0%
Applied egg-rr5.0%
associate-*r/5.0%
*-rgt-identity5.0%
+-commutative5.0%
associate--l+50.5%
+-inverses50.5%
metadata-eval50.5%
+-commutative50.5%
fma-def50.5%
+-commutative50.5%
+-commutative50.5%
Simplified50.5%
fma-udef50.5%
pow1/348.3%
unpow248.3%
pow-prod-down43.6%
+-commutative43.6%
pow1/344.4%
+-commutative44.4%
pow1/398.4%
+-commutative98.4%
pow298.4%
+-commutative98.4%
pow1/343.6%
*-commutative43.6%
pow1/398.4%
Applied egg-rr98.4%
Taylor expanded in x around 0 20.0%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 98.3%
expm1-log1p-u95.3%
expm1-udef95.3%
log1p-udef95.3%
add-exp-log98.3%
Applied egg-rr98.3%
associate--l+98.4%
+-commutative98.4%
Simplified98.4%
Final simplification63.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (+ t_0 (cbrt x))))
(if (<= x -1.35e+154)
(/ 1.0 (+ 1.0 (* (cbrt x) t_1)))
(if (<= x 1.35e+154)
(/ 1.0 (+ (pow t_0 2.0) (+ (cbrt (* x (+ 1.0 x))) (cbrt (* x x)))))
(/ 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 = t_0 + cbrt(x);
double tmp;
if (x <= -1.35e+154) {
tmp = 1.0 / (1.0 + (cbrt(x) * t_1));
} else if (x <= 1.35e+154) {
tmp = 1.0 / (pow(t_0, 2.0) + (cbrt((x * (1.0 + x))) + cbrt((x * x))));
} 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(t_0 + cbrt(x)) tmp = 0.0 if (x <= -1.35e+154) tmp = Float64(1.0 / Float64(1.0 + Float64(cbrt(x) * t_1))); elseif (x <= 1.35e+154) tmp = Float64(1.0 / Float64((t_0 ^ 2.0) + Float64(cbrt(Float64(x * Float64(1.0 + x))) + cbrt(Float64(x * x))))); 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[(t$95$0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.35e+154], N[(1.0 / N[(1.0 + N[(N[Power[x, 1/3], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.35e+154], N[(1.0 / N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[(N[Power[N[(x * N[(1.0 + x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision]), $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 := t_0 + \sqrt[3]{x}\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{1 + \sqrt[3]{x} \cdot t_1}\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{{t_0}^{2} + \left(\sqrt[3]{x \cdot \left(1 + x\right)} + \sqrt[3]{x \cdot x}\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 x < -1.35000000000000003e154Initial program 4.6%
flip3--4.6%
div-inv4.6%
rem-cube-cbrt3.9%
rem-cube-cbrt4.6%
cbrt-unprod4.6%
pow24.6%
distribute-rgt-out4.6%
+-commutative4.6%
Applied egg-rr4.6%
associate-*r/4.6%
*-rgt-identity4.6%
+-commutative4.6%
associate--l+4.6%
+-inverses4.6%
metadata-eval4.6%
+-commutative4.6%
fma-def4.6%
+-commutative4.6%
+-commutative4.6%
Simplified4.6%
fma-udef4.6%
pow1/34.6%
unpow24.6%
pow-prod-down0.0%
+-commutative0.0%
pow1/30.0%
+-commutative0.0%
pow1/398.4%
+-commutative98.4%
pow298.4%
+-commutative98.4%
pow1/30.0%
*-commutative0.0%
pow1/398.4%
Applied egg-rr98.4%
Taylor expanded in x around 0 19.9%
if -1.35000000000000003e154 < x < 1.35000000000000003e154Initial program 71.4%
flip3--71.4%
div-inv71.4%
rem-cube-cbrt72.1%
rem-cube-cbrt73.0%
cbrt-unprod73.0%
pow273.0%
distribute-rgt-out72.9%
+-commutative72.9%
Applied egg-rr72.9%
associate-*r/72.9%
*-rgt-identity72.9%
+-commutative72.9%
associate--l+99.5%
+-inverses99.5%
metadata-eval99.5%
+-commutative99.5%
fma-def99.5%
+-commutative99.5%
+-commutative99.5%
Simplified99.5%
fma-udef99.5%
pow1/398.2%
unpow298.2%
pow-prod-down82.8%
+-commutative82.8%
pow1/383.0%
+-commutative83.0%
pow1/399.5%
+-commutative99.5%
pow299.5%
+-commutative99.5%
pow1/349.3%
*-commutative49.3%
pow1/399.5%
Applied egg-rr99.5%
*-commutative99.5%
distribute-rgt-in99.4%
+-commutative99.4%
cbrt-unprod99.5%
+-commutative99.5%
cbrt-prod99.6%
Applied egg-rr99.6%
if 1.35000000000000003e154 < x Initial program 4.8%
flip3--4.8%
div-inv4.8%
rem-cube-cbrt2.9%
rem-cube-cbrt4.8%
cbrt-unprod4.8%
pow24.8%
distribute-rgt-out4.8%
+-commutative4.8%
Applied egg-rr4.8%
associate-*r/4.8%
*-rgt-identity4.8%
+-commutative4.8%
associate--l+4.8%
+-inverses4.8%
metadata-eval4.8%
+-commutative4.8%
fma-def4.8%
+-commutative4.8%
+-commutative4.8%
Simplified4.8%
pow1/34.8%
pow-pow91.6%
metadata-eval91.6%
Applied egg-rr91.6%
Final simplification88.0%
(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 56.0%
flip3--56.0%
div-inv56.0%
rem-cube-cbrt56.3%
rem-cube-cbrt57.2%
cbrt-unprod57.2%
pow257.2%
distribute-rgt-out57.2%
+-commutative57.2%
Applied egg-rr57.2%
associate-*r/57.2%
*-rgt-identity57.2%
+-commutative57.2%
associate--l+77.7%
+-inverses77.7%
metadata-eval77.7%
+-commutative77.7%
fma-def77.7%
+-commutative77.7%
+-commutative77.7%
Simplified77.7%
fma-udef77.7%
pow1/376.7%
unpow276.7%
pow-prod-down72.3%
+-commutative72.3%
pow1/372.6%
+-commutative72.6%
pow1/399.2%
+-commutative99.2%
pow299.2%
+-commutative99.2%
pow1/346.5%
*-commutative46.5%
pow1/399.2%
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(if (<= x -1.35e+154)
(/ 1.0 (+ 1.0 (* (cbrt x) (+ t_0 (cbrt x)))))
(/ 1.0 (+ (pow t_0 2.0) (+ (cbrt (* x (+ 1.0 x))) (cbrt (* x x))))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double tmp;
if (x <= -1.35e+154) {
tmp = 1.0 / (1.0 + (cbrt(x) * (t_0 + cbrt(x))));
} else {
tmp = 1.0 / (pow(t_0, 2.0) + (cbrt((x * (1.0 + x))) + cbrt((x * x))));
}
return tmp;
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
double tmp;
if (x <= -1.35e+154) {
tmp = 1.0 / (1.0 + (Math.cbrt(x) * (t_0 + Math.cbrt(x))));
} else {
tmp = 1.0 / (Math.pow(t_0, 2.0) + (Math.cbrt((x * (1.0 + x))) + Math.cbrt((x * x))));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) tmp = 0.0 if (x <= -1.35e+154) tmp = Float64(1.0 / Float64(1.0 + Float64(cbrt(x) * Float64(t_0 + cbrt(x))))); else tmp = Float64(1.0 / Float64((t_0 ^ 2.0) + Float64(cbrt(Float64(x * Float64(1.0 + x))) + cbrt(Float64(x * x))))); end return tmp end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[x, -1.35e+154], 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[(1.0 / N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[(N[Power[N[(x * N[(1.0 + x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{1 + \sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{t_0}^{2} + \left(\sqrt[3]{x \cdot \left(1 + x\right)} + \sqrt[3]{x \cdot x}\right)}\\
\end{array}
\end{array}
if x < -1.35000000000000003e154Initial program 4.6%
flip3--4.6%
div-inv4.6%
rem-cube-cbrt3.9%
rem-cube-cbrt4.6%
cbrt-unprod4.6%
pow24.6%
distribute-rgt-out4.6%
+-commutative4.6%
Applied egg-rr4.6%
associate-*r/4.6%
*-rgt-identity4.6%
+-commutative4.6%
associate--l+4.6%
+-inverses4.6%
metadata-eval4.6%
+-commutative4.6%
fma-def4.6%
+-commutative4.6%
+-commutative4.6%
Simplified4.6%
fma-udef4.6%
pow1/34.6%
unpow24.6%
pow-prod-down0.0%
+-commutative0.0%
pow1/30.0%
+-commutative0.0%
pow1/398.4%
+-commutative98.4%
pow298.4%
+-commutative98.4%
pow1/30.0%
*-commutative0.0%
pow1/398.4%
Applied egg-rr98.4%
Taylor expanded in x around 0 19.9%
if -1.35000000000000003e154 < x Initial program 64.2%
flip3--64.2%
div-inv64.2%
rem-cube-cbrt64.6%
rem-cube-cbrt65.6%
cbrt-unprod65.6%
pow265.6%
distribute-rgt-out65.5%
+-commutative65.5%
Applied egg-rr65.5%
associate-*r/65.5%
*-rgt-identity65.5%
+-commutative65.5%
associate--l+89.2%
+-inverses89.2%
metadata-eval89.2%
+-commutative89.2%
fma-def89.2%
+-commutative89.2%
+-commutative89.2%
Simplified89.2%
fma-udef89.2%
pow1/388.1%
unpow288.1%
pow-prod-down83.7%
+-commutative83.7%
pow1/384.1%
+-commutative84.1%
pow1/399.3%
+-commutative99.3%
pow299.3%
+-commutative99.3%
pow1/353.9%
*-commutative53.9%
pow1/399.3%
Applied egg-rr99.3%
*-commutative99.3%
distribute-rgt-in99.3%
+-commutative99.3%
cbrt-unprod89.2%
+-commutative89.2%
cbrt-prod89.3%
Applied egg-rr89.3%
Final simplification79.8%
(FPCore (x) :precision binary64 (if (<= x 1.95e+15) (- (+ 1.0 (+ (cbrt (+ 1.0 x)) -1.0)) (cbrt x)) (exp (* 0.6666666666666666 (- (log x))))))
double code(double x) {
double tmp;
if (x <= 1.95e+15) {
tmp = (1.0 + (cbrt((1.0 + x)) + -1.0)) - cbrt(x);
} else {
tmp = exp((0.6666666666666666 * -log(x)));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.95e+15) {
tmp = (1.0 + (Math.cbrt((1.0 + x)) + -1.0)) - Math.cbrt(x);
} else {
tmp = Math.exp((0.6666666666666666 * -Math.log(x)));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.95e+15) tmp = Float64(Float64(1.0 + Float64(cbrt(Float64(1.0 + x)) + -1.0)) - cbrt(x)); else tmp = exp(Float64(0.6666666666666666 * Float64(-log(x)))); end return tmp end
code[x_] := If[LessEqual[x, 1.95e+15], N[(N[(1.0 + N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], N[Exp[N[(0.6666666666666666 * (-N[Log[x], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.95 \cdot 10^{+15}:\\
\;\;\;\;\left(1 + \left(\sqrt[3]{1 + x} + -1\right)\right) - \sqrt[3]{x}\\
\mathbf{else}:\\
\;\;\;\;e^{0.6666666666666666 \cdot \left(-\log x\right)}\\
\end{array}
\end{array}
if x < 1.95e15Initial program 69.9%
expm1-log1p-u66.5%
expm1-udef66.5%
log1p-udef66.5%
add-exp-log69.9%
Applied egg-rr69.9%
associate--l+69.9%
+-commutative69.9%
Simplified69.9%
if 1.95e15 < x Initial program 4.1%
flip3--4.1%
div-inv4.1%
rem-cube-cbrt4.8%
rem-cube-cbrt5.9%
cbrt-unprod5.9%
pow25.9%
distribute-rgt-out5.9%
+-commutative5.9%
Applied egg-rr5.9%
associate-*r/5.9%
*-rgt-identity5.9%
+-commutative5.9%
associate--l+57.0%
+-inverses57.0%
metadata-eval57.0%
+-commutative57.0%
fma-def57.0%
+-commutative57.0%
+-commutative57.0%
Simplified57.0%
add-log-exp4.1%
*-un-lft-identity4.1%
log-prod4.1%
metadata-eval4.1%
add-log-exp57.0%
fma-udef57.0%
pow1/354.4%
*-commutative54.4%
pow1/353.5%
unpow253.5%
pow-prod-down91.4%
+-commutative91.4%
pow1/392.0%
+-commutative92.0%
pow1/392.9%
Applied egg-rr98.5%
+-lft-identity98.5%
Simplified98.5%
Applied egg-rr91.8%
Taylor expanded in x around inf 17.7%
log-pow17.7%
distribute-lft-neg-in17.7%
metadata-eval17.7%
log-rec17.7%
Simplified17.7%
Final simplification58.9%
(FPCore (x) :precision binary64 (if (<= x 1.95e+15) (- (cbrt (+ 1.0 x)) (cbrt x)) (exp (* 0.6666666666666666 (- (log x))))))
double code(double x) {
double tmp;
if (x <= 1.95e+15) {
tmp = cbrt((1.0 + x)) - cbrt(x);
} else {
tmp = exp((0.6666666666666666 * -log(x)));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.95e+15) {
tmp = Math.cbrt((1.0 + x)) - Math.cbrt(x);
} else {
tmp = Math.exp((0.6666666666666666 * -Math.log(x)));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.95e+15) tmp = Float64(cbrt(Float64(1.0 + x)) - cbrt(x)); else tmp = exp(Float64(0.6666666666666666 * Float64(-log(x)))); end return tmp end
code[x_] := If[LessEqual[x, 1.95e+15], N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], N[Exp[N[(0.6666666666666666 * (-N[Log[x], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.95 \cdot 10^{+15}:\\
\;\;\;\;\sqrt[3]{1 + x} - \sqrt[3]{x}\\
\mathbf{else}:\\
\;\;\;\;e^{0.6666666666666666 \cdot \left(-\log x\right)}\\
\end{array}
\end{array}
if x < 1.95e15Initial program 69.9%
if 1.95e15 < x Initial program 4.1%
flip3--4.1%
div-inv4.1%
rem-cube-cbrt4.8%
rem-cube-cbrt5.9%
cbrt-unprod5.9%
pow25.9%
distribute-rgt-out5.9%
+-commutative5.9%
Applied egg-rr5.9%
associate-*r/5.9%
*-rgt-identity5.9%
+-commutative5.9%
associate--l+57.0%
+-inverses57.0%
metadata-eval57.0%
+-commutative57.0%
fma-def57.0%
+-commutative57.0%
+-commutative57.0%
Simplified57.0%
add-log-exp4.1%
*-un-lft-identity4.1%
log-prod4.1%
metadata-eval4.1%
add-log-exp57.0%
fma-udef57.0%
pow1/354.4%
*-commutative54.4%
pow1/353.5%
unpow253.5%
pow-prod-down91.4%
+-commutative91.4%
pow1/392.0%
+-commutative92.0%
pow1/392.9%
Applied egg-rr98.5%
+-lft-identity98.5%
Simplified98.5%
Applied egg-rr91.8%
Taylor expanded in x around inf 17.7%
log-pow17.7%
distribute-lft-neg-in17.7%
metadata-eval17.7%
log-rec17.7%
Simplified17.7%
Final simplification58.9%
(FPCore (x) :precision binary64 (if (<= x 0.8) (- 1.0 (cbrt x)) (exp (* 0.6666666666666666 (- (log x))))))
double code(double x) {
double tmp;
if (x <= 0.8) {
tmp = 1.0 - cbrt(x);
} else {
tmp = exp((0.6666666666666666 * -log(x)));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 0.8) {
tmp = 1.0 - Math.cbrt(x);
} else {
tmp = Math.exp((0.6666666666666666 * -Math.log(x)));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 0.8) tmp = Float64(1.0 - cbrt(x)); else tmp = exp(Float64(0.6666666666666666 * Float64(-log(x)))); end return tmp end
code[x_] := If[LessEqual[x, 0.8], N[(1.0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], N[Exp[N[(0.6666666666666666 * (-N[Log[x], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.8:\\
\;\;\;\;1 - \sqrt[3]{x}\\
\mathbf{else}:\\
\;\;\;\;e^{0.6666666666666666 \cdot \left(-\log x\right)}\\
\end{array}
\end{array}
if x < 0.80000000000000004Initial program 69.7%
add-cube-cbrt69.7%
pow369.7%
Applied egg-rr69.7%
Taylor expanded in x around 0 33.2%
metadata-eval33.2%
pow-base-133.2%
unpow1/366.8%
*-lft-identity66.8%
Simplified66.8%
if 0.80000000000000004 < x Initial program 8.3%
flip3--8.2%
div-inv8.2%
rem-cube-cbrt8.9%
rem-cube-cbrt10.8%
cbrt-unprod10.8%
pow210.8%
distribute-rgt-out10.8%
+-commutative10.8%
Applied egg-rr10.8%
associate-*r/10.8%
*-rgt-identity10.8%
+-commutative10.8%
associate--l+59.2%
+-inverses59.2%
metadata-eval59.2%
+-commutative59.2%
fma-def59.2%
+-commutative59.2%
+-commutative59.2%
Simplified59.2%
add-log-exp7.4%
*-un-lft-identity7.4%
log-prod7.4%
metadata-eval7.4%
add-log-exp59.2%
fma-udef59.2%
pow1/356.7%
*-commutative56.7%
pow1/355.9%
unpow255.9%
pow-prod-down91.7%
+-commutative91.7%
pow1/392.3%
+-commutative92.3%
pow1/393.2%
Applied egg-rr98.5%
+-lft-identity98.5%
Simplified98.5%
Applied egg-rr92.1%
Taylor expanded in x around inf 17.7%
log-pow17.7%
distribute-lft-neg-in17.7%
metadata-eval17.7%
log-rec17.7%
Simplified17.7%
Final simplification55.9%
(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 56.0%
add-cube-cbrt55.9%
pow355.9%
Applied egg-rr55.9%
Taylor expanded in x around 0 26.8%
associate--l+26.8%
*-commutative26.8%
metadata-eval26.8%
pow-base-126.8%
unpow1/352.4%
*-lft-identity52.4%
Simplified52.4%
Final simplification52.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 56.0%
add-cube-cbrt55.9%
pow355.9%
Applied egg-rr55.9%
Taylor expanded in x around 0 26.2%
metadata-eval26.2%
pow-base-126.2%
unpow1/352.3%
*-lft-identity52.3%
Simplified52.3%
Final simplification52.3%
(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 56.0%
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 56.0%
Taylor expanded in x around 0 51.7%
Final simplification51.7%
herbie shell --seed 2023262
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
(- (cbrt (+ x 1.0)) (cbrt x)))