
(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 14 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 (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 59.4%
flip3--59.4%
div-inv59.4%
rem-cube-cbrt59.2%
rem-cube-cbrt59.9%
cbrt-unprod59.9%
pow259.9%
distribute-rgt-out59.9%
+-commutative59.9%
Applied egg-rr59.9%
associate-*r/59.9%
*-rgt-identity59.9%
+-commutative59.9%
associate--l+80.3%
+-inverses80.3%
metadata-eval80.3%
+-commutative80.3%
fma-def80.3%
+-commutative80.3%
+-commutative80.3%
Simplified80.3%
pow1/379.2%
+-commutative79.2%
pow-pow75.1%
pow-sqr75.1%
pow1/375.4%
+-commutative75.4%
pow1/399.2%
+-commutative99.2%
Applied egg-rr99.2%
unpow299.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x) :precision binary64 (if (<= (- (cbrt (+ 1.0 x)) (cbrt x)) 0.0) (pow (cbrt x) -2.0) (- (/ (cbrt (fma x x -1.0)) (cbrt (+ x -1.0))) (cbrt x))))
double code(double x) {
double tmp;
if ((cbrt((1.0 + x)) - cbrt(x)) <= 0.0) {
tmp = pow(cbrt(x), -2.0);
} else {
tmp = (cbrt(fma(x, x, -1.0)) / cbrt((x + -1.0))) - cbrt(x);
}
return tmp;
}
function code(x) tmp = 0.0 if (Float64(cbrt(Float64(1.0 + x)) - cbrt(x)) <= 0.0) tmp = cbrt(x) ^ -2.0; else tmp = Float64(Float64(cbrt(fma(x, x, -1.0)) / cbrt(Float64(x + -1.0))) - 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], 0.0], N[Power[N[Power[x, 1/3], $MachinePrecision], -2.0], $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}
\mathbf{if}\;\sqrt[3]{1 + x} - \sqrt[3]{x} \leq 0:\\
\;\;\;\;{\left(\sqrt[3]{x}\right)}^{-2}\\
\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.6%
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+53.1%
+-inverses53.1%
metadata-eval53.1%
+-commutative53.1%
fma-def53.1%
+-commutative53.1%
+-commutative53.1%
Simplified53.1%
add-sqr-sqrt53.0%
pow253.0%
Applied egg-rr53.0%
Taylor expanded in x around inf 11.4%
unpow1/311.4%
unpow211.4%
Simplified11.4%
expm1-log1p-u11.4%
expm1-udef4.3%
cbrt-prod4.3%
pow24.3%
Applied egg-rr4.3%
expm1-def17.7%
expm1-log1p17.7%
unpow217.7%
associate-/r*17.7%
*-rgt-identity17.7%
associate-*r/17.7%
unpow-117.7%
unpow-117.7%
pow-sqr17.7%
metadata-eval17.7%
Simplified17.7%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 99.0%
flip-+99.0%
cbrt-div99.0%
metadata-eval99.0%
fma-neg99.0%
metadata-eval99.0%
sub-neg99.0%
metadata-eval99.0%
Applied egg-rr99.0%
Final simplification65.1%
(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) t_0) 1.0))
(- (/ (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 / fma(cbrt(x), (cbrt(x) + t_0), 1.0);
} 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 / fma(cbrt(x), Float64(cbrt(x) + t_0), 1.0)); 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[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision] + 1.0), $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}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, 1\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.6%
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+53.1%
+-inverses53.1%
metadata-eval53.1%
+-commutative53.1%
fma-def53.1%
+-commutative53.1%
+-commutative53.1%
Simplified53.1%
Taylor expanded in x around 0 20.0%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 99.0%
flip-+99.0%
cbrt-div99.0%
metadata-eval99.0%
fma-neg99.0%
metadata-eval99.0%
sub-neg99.0%
metadata-eval99.0%
Applied egg-rr99.0%
Final simplification66.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(if (<= (- t_0 (cbrt x)) 0.0)
(pow (cbrt x) -2.0)
(- (log (exp (- (cbrt x) t_0)))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double tmp;
if ((t_0 - cbrt(x)) <= 0.0) {
tmp = pow(cbrt(x), -2.0);
} else {
tmp = -log(exp((cbrt(x) - t_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)) <= 0.0) {
tmp = Math.pow(Math.cbrt(x), -2.0);
} else {
tmp = -Math.log(Math.exp((Math.cbrt(x) - t_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 = cbrt(x) ^ -2.0; else tmp = Float64(-log(exp(Float64(cbrt(x) - t_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[Power[N[Power[x, 1/3], $MachinePrecision], -2.0], $MachinePrecision], (-N[Log[N[Exp[N[(N[Power[x, 1/3], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\mathbf{if}\;t_0 - \sqrt[3]{x} \leq 0:\\
\;\;\;\;{\left(\sqrt[3]{x}\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;-\log \left(e^{\sqrt[3]{x} - t_0}\right)\\
\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.6%
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+53.1%
+-inverses53.1%
metadata-eval53.1%
+-commutative53.1%
fma-def53.1%
+-commutative53.1%
+-commutative53.1%
Simplified53.1%
add-sqr-sqrt53.0%
pow253.0%
Applied egg-rr53.0%
Taylor expanded in x around inf 11.4%
unpow1/311.4%
unpow211.4%
Simplified11.4%
expm1-log1p-u11.4%
expm1-udef4.3%
cbrt-prod4.3%
pow24.3%
Applied egg-rr4.3%
expm1-def17.7%
expm1-log1p17.7%
unpow217.7%
associate-/r*17.7%
*-rgt-identity17.7%
associate-*r/17.7%
unpow-117.7%
unpow-117.7%
pow-sqr17.7%
metadata-eval17.7%
Simplified17.7%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 99.0%
add-log-exp99.0%
Applied egg-rr99.0%
add-log-exp99.0%
+-commutative99.0%
log1p-expm1-u98.5%
log1p-udef98.5%
add-log-exp98.4%
log-div98.4%
clear-num98.4%
log-rec98.4%
add-exp-log98.4%
log1p-udef98.4%
log1p-expm1-u98.8%
div-exp99.0%
Applied egg-rr99.0%
Final simplification65.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (+ (cbrt x) t_0)))
(if (<= x -1.34e+154)
(/ 1.0 (fma (cbrt x) t_1 1.0))
(if (<= x 1.32e+154)
(/ 1.0 (+ (pow t_0 2.0) (+ (cbrt (* x x)) (cbrt (+ x (* 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 = cbrt(x) + t_0;
double tmp;
if (x <= -1.34e+154) {
tmp = 1.0 / fma(cbrt(x), t_1, 1.0);
} else if (x <= 1.32e+154) {
tmp = 1.0 / (pow(t_0, 2.0) + (cbrt((x * x)) + cbrt((x + (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(cbrt(x) + t_0) tmp = 0.0 if (x <= -1.34e+154) tmp = Float64(1.0 / fma(cbrt(x), t_1, 1.0)); elseif (x <= 1.32e+154) tmp = Float64(1.0 / Float64((t_0 ^ 2.0) + Float64(cbrt(Float64(x * x)) + cbrt(Float64(x + 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[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision]}, If[LessEqual[x, -1.34e+154], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$1 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.32e+154], N[(1.0 / N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[(N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(x + N[(x * 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 := \sqrt[3]{x} + t_0\\
\mathbf{if}\;x \leq -1.34 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_1, 1\right)}\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{{t_0}^{2} + \left(\sqrt[3]{x \cdot x} + \sqrt[3]{x + 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.34000000000000001e154Initial program 4.6%
flip3--4.6%
div-inv4.6%
rem-cube-cbrt3.5%
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%
Taylor expanded in x around 0 20.0%
if -1.34000000000000001e154 < x < 1.31999999999999998e154Initial program 73.3%
flip3--73.4%
div-inv73.4%
rem-cube-cbrt73.5%
rem-cube-cbrt73.9%
cbrt-unprod74.0%
pow274.0%
distribute-rgt-out74.0%
+-commutative74.0%
Applied egg-rr74.0%
associate-*r/74.0%
*-rgt-identity74.0%
+-commutative74.0%
associate--l+99.6%
+-inverses99.6%
metadata-eval99.6%
+-commutative99.6%
fma-def99.6%
+-commutative99.6%
+-commutative99.6%
Simplified99.6%
pow1/398.2%
+-commutative98.2%
pow-pow83.0%
pow-sqr83.0%
pow1/383.2%
+-commutative83.2%
pow1/399.5%
+-commutative99.5%
Applied egg-rr99.5%
unpow299.5%
Simplified99.5%
fma-udef99.5%
+-commutative99.5%
distribute-rgt-in99.5%
cbrt-prod99.6%
add-sqr-sqrt63.4%
add-sqr-sqrt63.3%
hypot-udef63.4%
hypot-udef63.4%
+-commutative63.4%
Applied egg-rr99.7%
associate-+l+99.7%
Simplified99.7%
if 1.31999999999999998e154 < x Initial program 4.7%
flip3--4.7%
div-inv4.7%
rem-cube-cbrt3.0%
rem-cube-cbrt4.7%
cbrt-unprod4.7%
pow24.7%
distribute-rgt-out4.7%
+-commutative4.7%
Applied egg-rr4.7%
associate-*r/4.7%
*-rgt-identity4.7%
+-commutative4.7%
associate--l+4.7%
+-inverses4.7%
metadata-eval4.7%
+-commutative4.7%
fma-def4.7%
+-commutative4.7%
+-commutative4.7%
Simplified4.7%
pow1/34.7%
+-commutative4.7%
pow-pow91.5%
+-commutative91.5%
metadata-eval91.5%
Applied egg-rr91.5%
Final simplification90.5%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x)))) (/ 1.0 (+ (pow t_0 2.0) (* (cbrt x) (+ (cbrt x) t_0))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / (pow(t_0, 2.0) + (cbrt(x) * (cbrt(x) + t_0)));
}
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) * (Math.cbrt(x) + t_0)));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / Float64((t_0 ^ 2.0) + 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]}, N[(1.0 / N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $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(\sqrt[3]{x} + t_0\right)}
\end{array}
\end{array}
Initial program 59.4%
flip3--59.4%
div-inv59.4%
rem-cube-cbrt59.2%
rem-cube-cbrt59.9%
cbrt-unprod59.9%
pow259.9%
distribute-rgt-out59.9%
+-commutative59.9%
Applied egg-rr59.9%
associate-*r/59.9%
*-rgt-identity59.9%
+-commutative59.9%
associate--l+80.3%
+-inverses80.3%
metadata-eval80.3%
+-commutative80.3%
fma-def80.3%
+-commutative80.3%
+-commutative80.3%
Simplified80.3%
pow1/379.2%
+-commutative79.2%
pow-pow75.1%
pow-sqr75.1%
pow1/375.4%
+-commutative75.4%
pow1/399.2%
+-commutative99.2%
Applied egg-rr99.2%
unpow299.2%
Simplified99.2%
fma-udef99.2%
+-commutative99.2%
distribute-rgt-in99.2%
cbrt-prod80.3%
add-sqr-sqrt51.4%
add-sqr-sqrt51.4%
hypot-udef51.5%
hypot-udef51.4%
+-commutative51.4%
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(if (<= x -1.34e+154)
(/ 1.0 (fma (cbrt x) (+ (cbrt x) t_0) 1.0))
(/ 1.0 (+ (cbrt (+ x (* x x))) (+ (pow t_0 2.0) (cbrt (* x x))))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double tmp;
if (x <= -1.34e+154) {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + t_0), 1.0);
} else {
tmp = 1.0 / (cbrt((x + (x * x))) + (pow(t_0, 2.0) + cbrt((x * x))));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) tmp = 0.0 if (x <= -1.34e+154) tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), 1.0)); else tmp = Float64(1.0 / Float64(cbrt(Float64(x + Float64(x * x))) + Float64((t_0 ^ 2.0) + 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.34e+154], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[t$95$0, 2.0], $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.34 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt[3]{x + x \cdot x} + \left({t_0}^{2} + \sqrt[3]{x \cdot x}\right)}\\
\end{array}
\end{array}
if x < -1.34000000000000001e154Initial program 4.6%
flip3--4.6%
div-inv4.6%
rem-cube-cbrt3.5%
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%
Taylor expanded in x around 0 20.0%
if -1.34000000000000001e154 < x Initial program 65.8%
flip3--65.9%
div-inv65.9%
rem-cube-cbrt65.8%
rem-cube-cbrt66.4%
cbrt-unprod66.4%
pow266.4%
distribute-rgt-out66.4%
+-commutative66.4%
Applied egg-rr66.4%
associate-*r/66.4%
*-rgt-identity66.4%
+-commutative66.4%
associate--l+89.3%
+-inverses89.3%
metadata-eval89.3%
+-commutative89.3%
fma-def89.3%
+-commutative89.3%
+-commutative89.3%
Simplified89.3%
pow1/388.0%
+-commutative88.0%
pow-pow83.9%
pow-sqr83.9%
pow1/384.3%
+-commutative84.3%
pow1/399.3%
+-commutative99.3%
Applied egg-rr99.3%
unpow299.3%
Simplified99.3%
fma-udef99.3%
+-commutative99.3%
distribute-rgt-in99.3%
cbrt-prod89.2%
add-sqr-sqrt57.0%
add-sqr-sqrt56.9%
hypot-udef57.0%
hypot-udef57.0%
+-commutative57.0%
Applied egg-rr89.3%
Final simplification82.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(if (<= x -1.34e+154)
(/ 1.0 (fma (cbrt x) (+ (cbrt x) t_0) 1.0))
(/ 1.0 (+ (pow t_0 2.0) (+ (cbrt (* x x)) (cbrt (+ x (* x x)))))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
double tmp;
if (x <= -1.34e+154) {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + t_0), 1.0);
} else {
tmp = 1.0 / (pow(t_0, 2.0) + (cbrt((x * x)) + cbrt((x + (x * x)))));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) tmp = 0.0 if (x <= -1.34e+154) tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), 1.0)); else tmp = Float64(1.0 / Float64((t_0 ^ 2.0) + Float64(cbrt(Float64(x * x)) + cbrt(Float64(x + 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.34e+154], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[(N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(x + N[(x * 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.34 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{t_0}^{2} + \left(\sqrt[3]{x \cdot x} + \sqrt[3]{x + x \cdot x}\right)}\\
\end{array}
\end{array}
if x < -1.34000000000000001e154Initial program 4.6%
flip3--4.6%
div-inv4.6%
rem-cube-cbrt3.5%
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%
Taylor expanded in x around 0 20.0%
if -1.34000000000000001e154 < x Initial program 65.8%
flip3--65.9%
div-inv65.9%
rem-cube-cbrt65.8%
rem-cube-cbrt66.4%
cbrt-unprod66.4%
pow266.4%
distribute-rgt-out66.4%
+-commutative66.4%
Applied egg-rr66.4%
associate-*r/66.4%
*-rgt-identity66.4%
+-commutative66.4%
associate--l+89.3%
+-inverses89.3%
metadata-eval89.3%
+-commutative89.3%
fma-def89.3%
+-commutative89.3%
+-commutative89.3%
Simplified89.3%
pow1/388.0%
+-commutative88.0%
pow-pow83.9%
pow-sqr83.9%
pow1/384.3%
+-commutative84.3%
pow1/399.3%
+-commutative99.3%
Applied egg-rr99.3%
unpow299.3%
Simplified99.3%
fma-udef99.3%
+-commutative99.3%
distribute-rgt-in99.3%
cbrt-prod89.2%
add-sqr-sqrt57.0%
add-sqr-sqrt56.9%
hypot-udef57.0%
hypot-udef57.0%
+-commutative57.0%
Applied egg-rr89.3%
associate-+l+89.3%
Simplified89.3%
Final simplification82.0%
(FPCore (x) :precision binary64 (let* ((t_0 (- (cbrt (+ 1.0 x)) (cbrt x)))) (if (<= t_0 0.0) (pow (cbrt x) -2.0) t_0)))
double code(double x) {
double t_0 = cbrt((1.0 + x)) - cbrt(x);
double tmp;
if (t_0 <= 0.0) {
tmp = pow(cbrt(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 <= 0.0) {
tmp = Math.pow(Math.cbrt(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 <= 0.0) tmp = cbrt(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, 0.0], N[Power[N[Power[x, 1/3], $MachinePrecision], -2.0], $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x} - \sqrt[3]{x}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;{\left(\sqrt[3]{x}\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\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.6%
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+53.1%
+-inverses53.1%
metadata-eval53.1%
+-commutative53.1%
fma-def53.1%
+-commutative53.1%
+-commutative53.1%
Simplified53.1%
add-sqr-sqrt53.0%
pow253.0%
Applied egg-rr53.0%
Taylor expanded in x around inf 11.4%
unpow1/311.4%
unpow211.4%
Simplified11.4%
expm1-log1p-u11.4%
expm1-udef4.3%
cbrt-prod4.3%
pow24.3%
Applied egg-rr4.3%
expm1-def17.7%
expm1-log1p17.7%
unpow217.7%
associate-/r*17.7%
*-rgt-identity17.7%
associate-*r/17.7%
unpow-117.7%
unpow-117.7%
pow-sqr17.7%
metadata-eval17.7%
Simplified17.7%
if 0.0 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 99.0%
Final simplification65.0%
(FPCore (x)
:precision binary64
(if (<= x -0.24)
(pow (cbrt x) -2.0)
(if (<= x 4.2)
(/ 1.0 (+ 1.0 (cbrt x)))
(/ 1.0 (pow x 0.6666666666666666)))))
double code(double x) {
double tmp;
if (x <= -0.24) {
tmp = pow(cbrt(x), -2.0);
} else if (x <= 4.2) {
tmp = 1.0 / (1.0 + cbrt(x));
} else {
tmp = 1.0 / pow(x, 0.6666666666666666);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -0.24) {
tmp = Math.pow(Math.cbrt(x), -2.0);
} else if (x <= 4.2) {
tmp = 1.0 / (1.0 + Math.cbrt(x));
} else {
tmp = 1.0 / Math.pow(x, 0.6666666666666666);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= -0.24) tmp = cbrt(x) ^ -2.0; elseif (x <= 4.2) tmp = Float64(1.0 / Float64(1.0 + cbrt(x))); else tmp = Float64(1.0 / (x ^ 0.6666666666666666)); end return tmp end
code[x_] := If[LessEqual[x, -0.24], N[Power[N[Power[x, 1/3], $MachinePrecision], -2.0], $MachinePrecision], If[LessEqual[x, 4.2], N[(1.0 / N[(1.0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Power[x, 0.6666666666666666], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.24:\\
\;\;\;\;{\left(\sqrt[3]{x}\right)}^{-2}\\
\mathbf{elif}\;x \leq 4.2:\\
\;\;\;\;\frac{1}{1 + \sqrt[3]{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{x}^{0.6666666666666666}}\\
\end{array}
\end{array}
if x < -0.23999999999999999Initial program 6.9%
flip3--7.2%
div-inv7.2%
rem-cube-cbrt6.9%
rem-cube-cbrt7.3%
cbrt-unprod7.3%
pow27.3%
distribute-rgt-out7.3%
+-commutative7.3%
Applied egg-rr7.3%
associate-*r/7.3%
*-rgt-identity7.3%
+-commutative7.3%
associate--l+56.6%
+-inverses56.6%
metadata-eval56.6%
+-commutative56.6%
fma-def56.7%
+-commutative56.7%
+-commutative56.7%
Simplified56.7%
add-sqr-sqrt56.5%
pow256.5%
Applied egg-rr56.6%
Taylor expanded in x around inf 11.8%
unpow1/311.8%
unpow211.8%
Simplified11.8%
expm1-log1p-u11.8%
expm1-udef4.6%
cbrt-prod4.6%
pow24.6%
Applied egg-rr4.6%
expm1-def17.7%
expm1-log1p17.7%
unpow217.7%
associate-/r*17.7%
*-rgt-identity17.7%
associate-*r/17.7%
unpow-117.7%
unpow-117.7%
pow-sqr17.7%
metadata-eval17.7%
Simplified17.7%
if -0.23999999999999999 < x < 4.20000000000000018Initial program 99.9%
flip3--99.9%
div-inv99.9%
rem-cube-cbrt99.9%
rem-cube-cbrt99.9%
cbrt-unprod99.9%
pow299.9%
distribute-rgt-out99.9%
+-commutative99.9%
Applied egg-rr99.9%
associate-*r/99.9%
*-rgt-identity99.9%
+-commutative99.9%
associate--l+99.9%
+-inverses99.9%
metadata-eval99.9%
+-commutative99.9%
fma-def99.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
add-sqr-sqrt99.9%
pow299.9%
Applied egg-rr48.5%
Taylor expanded in x around 0 47.3%
unpow1/397.5%
+-commutative97.5%
Simplified97.5%
if 4.20000000000000018 < x Initial program 7.5%
flip3--7.5%
div-inv7.5%
rem-cube-cbrt6.9%
rem-cube-cbrt9.7%
cbrt-unprod9.6%
pow29.6%
distribute-rgt-out9.6%
+-commutative9.6%
Applied egg-rr9.6%
associate-*r/9.6%
*-rgt-identity9.6%
+-commutative9.6%
associate--l+53.4%
+-inverses53.4%
metadata-eval53.4%
+-commutative53.4%
fma-def53.4%
+-commutative53.4%
+-commutative53.4%
Simplified53.4%
add-sqr-sqrt53.3%
pow253.3%
Applied egg-rr53.3%
Taylor expanded in x around inf 11.4%
unpow1/311.4%
unpow211.4%
Simplified11.4%
pow1/311.4%
pow-prod-down17.7%
pow-sqr17.7%
metadata-eval17.7%
Applied egg-rr17.7%
Final simplification62.6%
(FPCore (x)
:precision binary64
(if (<= x -0.24)
(/ 1.0 (cbrt (* x x)))
(if (<= x 4.2)
(/ 1.0 (+ 1.0 (cbrt x)))
(/ 1.0 (pow x 0.6666666666666666)))))
double code(double x) {
double tmp;
if (x <= -0.24) {
tmp = 1.0 / cbrt((x * x));
} else if (x <= 4.2) {
tmp = 1.0 / (1.0 + cbrt(x));
} else {
tmp = 1.0 / pow(x, 0.6666666666666666);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -0.24) {
tmp = 1.0 / Math.cbrt((x * x));
} else if (x <= 4.2) {
tmp = 1.0 / (1.0 + Math.cbrt(x));
} else {
tmp = 1.0 / Math.pow(x, 0.6666666666666666);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= -0.24) tmp = Float64(1.0 / cbrt(Float64(x * x))); elseif (x <= 4.2) tmp = Float64(1.0 / Float64(1.0 + cbrt(x))); else tmp = Float64(1.0 / (x ^ 0.6666666666666666)); end return tmp end
code[x_] := If[LessEqual[x, -0.24], N[(1.0 / N[Power[N[(x * x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.2], N[(1.0 / N[(1.0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Power[x, 0.6666666666666666], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.24:\\
\;\;\;\;\frac{1}{\sqrt[3]{x \cdot x}}\\
\mathbf{elif}\;x \leq 4.2:\\
\;\;\;\;\frac{1}{1 + \sqrt[3]{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{x}^{0.6666666666666666}}\\
\end{array}
\end{array}
if x < -0.23999999999999999Initial program 6.9%
flip3--7.2%
div-inv7.2%
rem-cube-cbrt6.9%
rem-cube-cbrt7.3%
cbrt-unprod7.3%
pow27.3%
distribute-rgt-out7.3%
+-commutative7.3%
Applied egg-rr7.3%
associate-*r/7.3%
*-rgt-identity7.3%
+-commutative7.3%
associate--l+56.6%
+-inverses56.6%
metadata-eval56.6%
+-commutative56.6%
fma-def56.7%
+-commutative56.7%
+-commutative56.7%
Simplified56.7%
add-sqr-sqrt56.5%
pow256.5%
Applied egg-rr56.6%
Taylor expanded in x around inf 11.8%
unpow1/311.8%
unpow211.8%
Simplified11.8%
if -0.23999999999999999 < x < 4.20000000000000018Initial program 99.9%
flip3--99.9%
div-inv99.9%
rem-cube-cbrt99.9%
rem-cube-cbrt99.9%
cbrt-unprod99.9%
pow299.9%
distribute-rgt-out99.9%
+-commutative99.9%
Applied egg-rr99.9%
associate-*r/99.9%
*-rgt-identity99.9%
+-commutative99.9%
associate--l+99.9%
+-inverses99.9%
metadata-eval99.9%
+-commutative99.9%
fma-def99.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
add-sqr-sqrt99.9%
pow299.9%
Applied egg-rr48.5%
Taylor expanded in x around 0 47.3%
unpow1/397.5%
+-commutative97.5%
Simplified97.5%
if 4.20000000000000018 < x Initial program 7.5%
flip3--7.5%
div-inv7.5%
rem-cube-cbrt6.9%
rem-cube-cbrt9.7%
cbrt-unprod9.6%
pow29.6%
distribute-rgt-out9.6%
+-commutative9.6%
Applied egg-rr9.6%
associate-*r/9.6%
*-rgt-identity9.6%
+-commutative9.6%
associate--l+53.4%
+-inverses53.4%
metadata-eval53.4%
+-commutative53.4%
fma-def53.4%
+-commutative53.4%
+-commutative53.4%
Simplified53.4%
add-sqr-sqrt53.3%
pow253.3%
Applied egg-rr53.3%
Taylor expanded in x around inf 11.4%
unpow1/311.4%
unpow211.4%
Simplified11.4%
pow1/311.4%
pow-prod-down17.7%
pow-sqr17.7%
metadata-eval17.7%
Applied egg-rr17.7%
Final simplification61.2%
(FPCore (x) :precision binary64 (if (<= x 1.0) 1.0 (/ 1.0 (pow x 0.6666666666666666))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = 1.0 / pow(x, 0.6666666666666666);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.0d0) then
tmp = 1.0d0
else
tmp = 1.0d0 / (x ** 0.6666666666666666d0)
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = 1.0 / Math.pow(x, 0.6666666666666666);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = 1.0 else: tmp = 1.0 / math.pow(x, 0.6666666666666666) return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = 1.0; else tmp = Float64(1.0 / (x ^ 0.6666666666666666)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.0) tmp = 1.0; else tmp = 1.0 / (x ^ 0.6666666666666666); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], 1.0, N[(1.0 / N[Power[x, 0.6666666666666666], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{x}^{0.6666666666666666}}\\
\end{array}
\end{array}
if x < 1Initial program 72.6%
Taylor expanded in x around 0 69.1%
if 1 < x Initial program 7.5%
flip3--7.5%
div-inv7.5%
rem-cube-cbrt6.9%
rem-cube-cbrt9.7%
cbrt-unprod9.6%
pow29.6%
distribute-rgt-out9.6%
+-commutative9.6%
Applied egg-rr9.6%
associate-*r/9.6%
*-rgt-identity9.6%
+-commutative9.6%
associate--l+53.4%
+-inverses53.4%
metadata-eval53.4%
+-commutative53.4%
fma-def53.4%
+-commutative53.4%
+-commutative53.4%
Simplified53.4%
add-sqr-sqrt53.3%
pow253.3%
Applied egg-rr53.3%
Taylor expanded in x around inf 11.4%
unpow1/311.4%
unpow211.4%
Simplified11.4%
pow1/311.4%
pow-prod-down17.7%
pow-sqr17.7%
metadata-eval17.7%
Applied egg-rr17.7%
Final simplification58.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 59.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 59.4%
Taylor expanded in x around 0 56.3%
Final simplification56.3%
herbie shell --seed 2023182
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
(- (cbrt (+ x 1.0)) (cbrt x)))