
(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 9 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
(/ (cbrt x) (/ (+ t_1 (* (cbrt x) (- (cbrt x) t_0))) (+ x (+ 1.0 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 + (cbrt(x) / ((t_1 + (cbrt(x) * (cbrt(x) - t_0))) / (x + (1.0 + 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 + (Math.cbrt(x) / ((t_1 + (Math.cbrt(x) * (Math.cbrt(x) - t_0))) / (x + (1.0 + 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(cbrt(x) / Float64(Float64(t_1 + Float64(cbrt(x) * Float64(cbrt(x) - t_0))) / Float64(x + Float64(1.0 + 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[Power[x, 1/3], $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[(x + N[(1.0 + x), $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 + \frac{\sqrt[3]{x}}{\frac{t_1 + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} - t_0\right)}{x + \left(1 + x\right)}}}
\end{array}
\end{array}
Initial program 53.4%
flip3--53.6%
div-inv53.6%
rem-cube-cbrt53.2%
rem-cube-cbrt54.6%
cbrt-unprod54.7%
pow254.7%
distribute-rgt-out54.7%
+-commutative54.7%
Applied egg-rr54.7%
associate-*r/54.7%
*-rgt-identity54.7%
+-commutative54.7%
associate--l+77.3%
+-inverses77.3%
metadata-eval77.3%
+-commutative77.3%
fma-def77.3%
+-commutative77.3%
+-commutative77.3%
Simplified77.3%
pow1/376.2%
unpow276.2%
pow-prod-down75.1%
+-commutative75.1%
pow1/375.5%
+-commutative75.5%
pow1/399.2%
fma-def99.2%
+-commutative99.2%
pow299.2%
+-commutative99.2%
+-commutative99.2%
Applied egg-rr99.2%
add-sqr-sqrt78.1%
pow278.1%
Applied egg-rr55.4%
unpow255.4%
hypot-udef55.4%
hypot-udef55.4%
add-sqr-sqrt55.4%
cbrt-unprod43.4%
hypot-udef43.4%
hypot-udef43.4%
add-sqr-sqrt43.4%
add-sqr-sqrt77.3%
distribute-rgt1-in77.3%
+-commutative77.3%
cbrt-unprod99.2%
+-commutative99.2%
unpow1/375.5%
Applied egg-rr86.4%
associate-/l*99.7%
Simplified99.7%
Final simplification99.7%
(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.35e+154)
(/ 1.0 (+ (cbrt (* x x)) (+ (pow t_0 2.0) (cbrt (* x (+ 1.0 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.35e+154) {
tmp = 1.0 / (cbrt((x * x)) + (pow(t_0, 2.0) + cbrt((x * (1.0 + 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.35e+154) {
tmp = 1.0 / (Math.cbrt((x * x)) + (Math.pow(t_0, 2.0) + Math.cbrt((x * (1.0 + 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.35e+154) tmp = Float64(1.0 / Float64(cbrt(Float64(x * x)) + Float64((t_0 ^ 2.0) + cbrt(Float64(x * Float64(1.0 + 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.35e+154], N[(1.0 / N[(N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[Power[N[(x * N[(1.0 + x), $MachinePrecision]), $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.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{\sqrt[3]{x \cdot x} + \left({t_0}^{2} + \sqrt[3]{x \cdot \left(1 + x\right)}\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.9%
flip3--4.9%
div-inv4.9%
rem-cube-cbrt3.5%
rem-cube-cbrt4.9%
cbrt-unprod4.9%
pow24.9%
distribute-rgt-out4.9%
+-commutative4.9%
Applied egg-rr4.9%
associate-*r/4.9%
*-rgt-identity4.9%
+-commutative4.9%
associate--l+4.9%
+-inverses4.9%
metadata-eval4.9%
+-commutative4.9%
fma-def4.9%
+-commutative4.9%
+-commutative4.9%
Simplified4.9%
pow1/34.9%
unpow24.9%
pow-prod-down0.0%
+-commutative0.0%
pow1/30.0%
+-commutative0.0%
pow1/398.7%
fma-def98.7%
+-commutative98.7%
pow298.7%
+-commutative98.7%
+-commutative98.7%
Applied egg-rr98.7%
Taylor expanded in x around 0 19.9%
if -1.35000000000000003e154 < x < 1.35000000000000003e154Initial program 68.3%
flip3--68.6%
div-inv68.5%
rem-cube-cbrt68.5%
rem-cube-cbrt69.9%
cbrt-unprod69.9%
pow269.9%
distribute-rgt-out69.9%
+-commutative69.9%
Applied egg-rr69.9%
associate-*r/69.9%
*-rgt-identity69.9%
+-commutative69.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.0%
unpow298.0%
pow-prod-down82.6%
+-commutative82.6%
pow1/382.9%
+-commutative82.9%
pow1/399.4%
+-commutative99.4%
+-commutative99.4%
+-commutative99.4%
distribute-rgt-in99.4%
associate-+r+99.4%
Applied egg-rr99.5%
+-commutative99.5%
associate-+l+99.5%
*-commutative99.5%
Simplified99.5%
unpow299.5%
cbrt-unprod99.6%
Applied egg-rr99.6%
if 1.35000000000000003e154 < x Initial program 4.8%
flip3--4.8%
div-inv4.8%
rem-cube-cbrt2.8%
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%
unpow24.8%
pow-prod-down91.5%
+-commutative91.5%
pow1/393.0%
+-commutative93.0%
pow1/398.4%
fma-def98.3%
+-commutative98.3%
pow298.3%
+-commutative98.3%
+-commutative98.3%
Applied egg-rr98.3%
unpow298.3%
cbrt-prod4.8%
unpow24.8%
expm1-log1p-u4.8%
expm1-udef4.8%
Applied egg-rr91.3%
expm1-def91.3%
expm1-log1p91.0%
exp-prod92.1%
Simplified92.1%
Final simplification90.2%
(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 (* (- 1.0 (* x x)) (/ 1.0 (- 1.0 x)))) (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(((1.0 - (x * x)) * (1.0 / (1.0 - x)))) - 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 = Math.cbrt(((1.0 - (x * x)) * (1.0 / (1.0 - x)))) - 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(cbrt(Float64(Float64(1.0 - Float64(x * x)) * Float64(1.0 / Float64(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], 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[Power[N[(N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $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}:\\
\;\;\;\;\sqrt[3]{\left(1 - x \cdot x\right) \cdot \frac{1}{1 - x}} - \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%
rem-cube-cbrt4.2%
cbrt-unprod4.2%
pow24.2%
distribute-rgt-out4.2%
+-commutative4.2%
Applied egg-rr4.2%
associate-*r/4.2%
*-rgt-identity4.2%
+-commutative4.2%
associate--l+52.1%
+-inverses52.1%
metadata-eval52.1%
+-commutative52.1%
fma-def52.1%
+-commutative52.1%
+-commutative52.1%
Simplified52.1%
pow1/349.8%
unpow249.8%
pow-prod-down49.8%
+-commutative49.8%
pow1/350.7%
+-commutative50.7%
pow1/398.4%
fma-def98.4%
+-commutative98.4%
pow298.4%
+-commutative98.4%
+-commutative98.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 97.5%
add-exp-log96.0%
pow1/396.0%
log-pow96.0%
+-commutative96.0%
log1p-udef96.0%
Applied egg-rr96.0%
*-commutative96.0%
exp-prod96.0%
unpow1/396.1%
Simplified96.1%
log1p-udef96.1%
add-exp-log97.5%
flip-+97.5%
div-inv97.5%
metadata-eval97.5%
Applied egg-rr97.5%
Final simplification60.9%
(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 (+ (cbrt (* x x)) (+ (pow t_0 2.0) (cbrt (* x (+ 1.0 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 / (cbrt((x * x)) + (pow(t_0, 2.0) + cbrt((x * (1.0 + 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(cbrt(Float64(x * x)) + Float64((t_0 ^ 2.0) + cbrt(Float64(x * Float64(1.0 + 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[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[Power[N[(x * N[(1.0 + x), $MachinePrecision]), $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}{\sqrt[3]{x \cdot x} + \left({t_0}^{2} + \sqrt[3]{x \cdot \left(1 + x\right)}\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.9%
flip3--4.9%
div-inv4.9%
rem-cube-cbrt3.5%
rem-cube-cbrt4.9%
cbrt-unprod4.9%
pow24.9%
distribute-rgt-out4.9%
+-commutative4.9%
Applied egg-rr4.9%
associate-*r/4.9%
*-rgt-identity4.9%
+-commutative4.9%
associate--l+4.9%
+-inverses4.9%
metadata-eval4.9%
+-commutative4.9%
fma-def4.9%
+-commutative4.9%
+-commutative4.9%
Simplified4.9%
pow1/34.9%
unpow24.9%
pow-prod-down0.0%
+-commutative0.0%
pow1/30.0%
+-commutative0.0%
pow1/398.7%
fma-def98.7%
+-commutative98.7%
pow298.7%
+-commutative98.7%
+-commutative98.7%
Applied egg-rr98.7%
Taylor expanded in x around 0 19.9%
if -1.35000000000000003e154 < x < 1.35000000000000003e154Initial program 68.3%
flip3--68.6%
div-inv68.5%
rem-cube-cbrt68.5%
rem-cube-cbrt69.9%
cbrt-unprod69.9%
pow269.9%
distribute-rgt-out69.9%
+-commutative69.9%
Applied egg-rr69.9%
associate-*r/69.9%
*-rgt-identity69.9%
+-commutative69.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.0%
unpow298.0%
pow-prod-down82.6%
+-commutative82.6%
pow1/382.9%
+-commutative82.9%
pow1/399.4%
+-commutative99.4%
+-commutative99.4%
+-commutative99.4%
distribute-rgt-in99.4%
associate-+r+99.4%
Applied egg-rr99.5%
+-commutative99.5%
associate-+l+99.5%
*-commutative99.5%
Simplified99.5%
unpow299.5%
cbrt-unprod99.6%
Applied egg-rr99.6%
if 1.35000000000000003e154 < x Initial program 4.8%
flip3--4.8%
div-inv4.8%
rem-cube-cbrt2.8%
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.5%
metadata-eval91.5%
Applied egg-rr91.5%
Final simplification90.1%
(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 53.4%
flip3--53.6%
div-inv53.6%
rem-cube-cbrt53.2%
rem-cube-cbrt54.6%
cbrt-unprod54.7%
pow254.7%
distribute-rgt-out54.7%
+-commutative54.7%
Applied egg-rr54.7%
associate-*r/54.7%
*-rgt-identity54.7%
+-commutative54.7%
associate--l+77.3%
+-inverses77.3%
metadata-eval77.3%
+-commutative77.3%
fma-def77.3%
+-commutative77.3%
+-commutative77.3%
Simplified77.3%
pow1/376.2%
unpow276.2%
pow-prod-down75.1%
+-commutative75.1%
pow1/375.5%
+-commutative75.5%
pow1/399.2%
fma-def99.2%
+-commutative99.2%
pow299.2%
+-commutative99.2%
+-commutative99.2%
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(if (or (<= x -1.35e+154) (not (<= x 1.35e+154)))
(/ 1.0 (+ 1.0 (* (cbrt x) (+ t_0 (cbrt x)))))
(/ 1.0 (+ (cbrt (* x x)) (+ (pow t_0 2.0) (cbrt (* x (+ 1.0 x)))))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double tmp;
if ((x <= -1.35e+154) || !(x <= 1.35e+154)) {
tmp = 1.0 / (1.0 + (cbrt(x) * (t_0 + cbrt(x))));
} else {
tmp = 1.0 / (cbrt((x * x)) + (pow(t_0, 2.0) + cbrt((x * (1.0 + x)))));
}
return tmp;
}
public static double code(double x) {
double t_0 = Math.cbrt((1.0 + x));
double tmp;
if ((x <= -1.35e+154) || !(x <= 1.35e+154)) {
tmp = 1.0 / (1.0 + (Math.cbrt(x) * (t_0 + Math.cbrt(x))));
} else {
tmp = 1.0 / (Math.cbrt((x * x)) + (Math.pow(t_0, 2.0) + Math.cbrt((x * (1.0 + x)))));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) tmp = 0.0 if ((x <= -1.35e+154) || !(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(cbrt(Float64(x * x)) + Float64((t_0 ^ 2.0) + cbrt(Float64(x * Float64(1.0 + x)))))); end return tmp end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, If[Or[LessEqual[x, -1.35e+154], N[Not[LessEqual[x, 1.35e+154]], $MachinePrecision]], 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[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[Power[N[(x * N[(1.0 + x), $MachinePrecision]), $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} \lor \neg \left(x \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;\frac{1}{1 + \sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt[3]{x \cdot x} + \left({t_0}^{2} + \sqrt[3]{x \cdot \left(1 + x\right)}\right)}\\
\end{array}
\end{array}
if x < -1.35000000000000003e154 or 1.35000000000000003e154 < x Initial program 4.8%
flip3--4.8%
div-inv4.8%
rem-cube-cbrt3.1%
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%
unpow24.8%
pow-prod-down50.3%
+-commutative50.3%
pow1/351.2%
+-commutative51.2%
pow1/398.5%
fma-def98.5%
+-commutative98.5%
pow298.5%
+-commutative98.5%
+-commutative98.5%
Applied egg-rr98.5%
Taylor expanded in x around 0 19.9%
if -1.35000000000000003e154 < x < 1.35000000000000003e154Initial program 68.3%
flip3--68.6%
div-inv68.5%
rem-cube-cbrt68.5%
rem-cube-cbrt69.9%
cbrt-unprod69.9%
pow269.9%
distribute-rgt-out69.9%
+-commutative69.9%
Applied egg-rr69.9%
associate-*r/69.9%
*-rgt-identity69.9%
+-commutative69.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.0%
unpow298.0%
pow-prod-down82.6%
+-commutative82.6%
pow1/382.9%
+-commutative82.9%
pow1/399.4%
+-commutative99.4%
+-commutative99.4%
+-commutative99.4%
distribute-rgt-in99.4%
associate-+r+99.4%
Applied egg-rr99.5%
+-commutative99.5%
associate-+l+99.5%
*-commutative99.5%
Simplified99.5%
unpow299.5%
cbrt-unprod99.6%
Applied egg-rr99.6%
Final simplification80.9%
(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.4%
Final simplification53.4%
(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.4%
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 53.4%
Taylor expanded in x around 0 50.3%
Final simplification50.3%
herbie shell --seed 2023187
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
(- (cbrt (+ x 1.0)) (cbrt x)))