
(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
(cbrt x)
(+ (cbrt x) t_0)
(pow (/ (* t_0 (- (- 2.0) t_0)) (- -2.0 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 - t_0)) / (-2.0 - 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), (Float64(Float64(t_0 * Float64(Float64(-2.0) - t_0)) / Float64(-2.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[N[(N[(t$95$0 * N[((-2.0) - t$95$0), $MachinePrecision]), $MachinePrecision] / N[(-2.0 - t$95$0), $MachinePrecision]), $MachinePrecision], 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, {\left(\frac{t_0 \cdot \left(\left(-2\right) - t_0\right)}{-2 - t_0}\right)}^{2}\right)}
\end{array}
\end{array}
Initial program 53.4%
flip3--53.3%
div-inv53.3%
rem-cube-cbrt53.4%
rem-cube-cbrt54.5%
cbrt-unprod54.6%
pow254.6%
distribute-rgt-out54.5%
+-commutative54.5%
Applied egg-rr54.5%
associate-*r/54.5%
*-rgt-identity54.5%
+-commutative54.5%
associate--l+79.8%
+-inverses79.8%
metadata-eval79.8%
+-commutative79.8%
fma-def79.8%
+-commutative79.8%
+-commutative79.8%
Simplified79.8%
expm1-log1p-u78.7%
expm1-udef78.7%
+-commutative78.7%
pow278.7%
cbrt-prod97.0%
pow297.0%
+-commutative97.0%
Applied egg-rr97.0%
expm1-def97.0%
expm1-log1p99.1%
Simplified99.1%
+-commutative99.1%
expm1-log1p-u76.0%
expm1-udef76.0%
flip--76.0%
log1p-udef76.0%
add-exp-log77.2%
+-commutative77.2%
log1p-udef77.1%
add-exp-log76.0%
+-commutative76.0%
metadata-eval76.0%
log1p-udef76.0%
add-exp-log99.1%
+-commutative99.1%
Applied egg-rr99.1%
difference-of-sqr-199.1%
+-commutative99.1%
associate-+r+99.1%
metadata-eval99.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
associate-+r+99.1%
metadata-eval99.1%
+-commutative99.1%
associate-+r+99.1%
metadata-eval99.1%
Simplified99.1%
frac-2neg99.1%
distribute-frac-neg99.1%
+-lft-identity99.1%
*-commutative99.1%
+-commutative99.1%
distribute-neg-in99.1%
metadata-eval99.1%
Applied egg-rr99.1%
distribute-neg-frac99.1%
*-commutative99.1%
distribute-rgt-neg-in99.1%
+-commutative99.1%
unsub-neg99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ (cbrt x) (cbrt (+ 1.0 x)))))
(if (<= x 1.35e+154)
(/ 1.0 (fma (cbrt x) t_0 (cbrt (pow (+ 1.0 x) 2.0))))
(/ 1.0 (fma (cbrt x) t_0 (exp (* 0.6666666666666666 (log1p x))))))))
double code(double x) {
double t_0 = cbrt(x) + cbrt((1.0 + x));
double tmp;
if (x <= 1.35e+154) {
tmp = 1.0 / fma(cbrt(x), t_0, cbrt(pow((1.0 + x), 2.0)));
} else {
tmp = 1.0 / fma(cbrt(x), t_0, exp((0.6666666666666666 * log1p(x))));
}
return tmp;
}
function code(x) t_0 = Float64(cbrt(x) + cbrt(Float64(1.0 + x))) tmp = 0.0 if (x <= 1.35e+154) tmp = Float64(1.0 / fma(cbrt(x), t_0, cbrt((Float64(1.0 + x) ^ 2.0)))); else tmp = Float64(1.0 / fma(cbrt(x), t_0, exp(Float64(0.6666666666666666 * log1p(x))))); end return tmp end
code[x_] := Block[{t$95$0 = N[(N[Power[x, 1/3], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.35e+154], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0 + N[Power[N[Power[N[(1.0 + x), $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0 + N[Exp[N[(0.6666666666666666 * N[Log[1 + x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{x} + \sqrt[3]{1 + x}\\
\mathbf{if}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_0, \sqrt[3]{{\left(1 + x\right)}^{2}}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_0, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 59.6%
flip3--59.6%
div-inv59.6%
rem-cube-cbrt59.8%
rem-cube-cbrt60.9%
cbrt-unprod60.9%
pow260.9%
distribute-rgt-out60.9%
+-commutative60.9%
Applied egg-rr60.9%
associate-*r/60.9%
*-rgt-identity60.9%
+-commutative60.9%
associate--l+89.4%
+-inverses89.4%
metadata-eval89.4%
+-commutative89.4%
fma-def89.4%
+-commutative89.4%
+-commutative89.4%
Simplified89.4%
if 1.35000000000000003e154 < 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%
add-exp-log4.7%
pow1/34.7%
log-pow4.7%
+-commutative4.7%
log-pow92.5%
+-commutative92.5%
log1p-udef92.5%
Applied egg-rr92.5%
associate-*r*92.5%
metadata-eval92.5%
Simplified92.5%
Final simplification89.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ (cbrt x) (cbrt (+ 1.0 x)))))
(if (<= x 1.35e+154)
(/ (+ 1.0 (- x x)) (+ (cbrt (pow (+ 1.0 x) 2.0)) (* (cbrt x) t_0)))
(/ 1.0 (fma (cbrt x) t_0 (exp (* 0.6666666666666666 (log1p x))))))))
double code(double x) {
double t_0 = cbrt(x) + cbrt((1.0 + x));
double tmp;
if (x <= 1.35e+154) {
tmp = (1.0 + (x - x)) / (cbrt(pow((1.0 + x), 2.0)) + (cbrt(x) * t_0));
} else {
tmp = 1.0 / fma(cbrt(x), t_0, exp((0.6666666666666666 * log1p(x))));
}
return tmp;
}
function code(x) t_0 = Float64(cbrt(x) + cbrt(Float64(1.0 + x))) tmp = 0.0 if (x <= 1.35e+154) tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(cbrt((Float64(1.0 + x) ^ 2.0)) + Float64(cbrt(x) * t_0))); else tmp = Float64(1.0 / fma(cbrt(x), t_0, exp(Float64(0.6666666666666666 * log1p(x))))); end return tmp end
code[x_] := Block[{t$95$0 = N[(N[Power[x, 1/3], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.35e+154], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Power[N[Power[N[(1.0 + x), $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0 + N[Exp[N[(0.6666666666666666 * N[Log[1 + x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{x} + \sqrt[3]{1 + x}\\
\mathbf{if}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt[3]{{\left(1 + x\right)}^{2}} + \sqrt[3]{x} \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_0, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 59.6%
flip3--59.6%
rem-cube-cbrt59.8%
rem-cube-cbrt60.9%
cbrt-unprod60.9%
pow260.9%
distribute-rgt-out60.9%
+-commutative60.9%
Applied egg-rr60.9%
+-commutative60.9%
associate--l+89.4%
Applied egg-rr89.4%
if 1.35000000000000003e154 < 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%
add-exp-log4.7%
pow1/34.7%
log-pow4.7%
+-commutative4.7%
log-pow92.5%
+-commutative92.5%
log1p-udef92.5%
Applied egg-rr92.5%
associate-*r*92.5%
metadata-eval92.5%
Simplified92.5%
Final simplification89.7%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x)))) (/ 1.0 (fma (cbrt x) (+ (cbrt x) t_0) (pow t_0 2.0)))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / fma(cbrt(x), (cbrt(x) + t_0), pow(t_0, 2.0));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), (t_0 ^ 2.0))) end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision] + N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, {t_0}^{2}\right)}
\end{array}
\end{array}
Initial program 53.4%
flip3--53.3%
div-inv53.3%
rem-cube-cbrt53.4%
rem-cube-cbrt54.5%
cbrt-unprod54.6%
pow254.6%
distribute-rgt-out54.5%
+-commutative54.5%
Applied egg-rr54.5%
associate-*r/54.5%
*-rgt-identity54.5%
+-commutative54.5%
associate--l+79.8%
+-inverses79.8%
metadata-eval79.8%
+-commutative79.8%
fma-def79.8%
+-commutative79.8%
+-commutative79.8%
Simplified79.8%
expm1-log1p-u78.7%
expm1-udef78.7%
+-commutative78.7%
pow278.7%
cbrt-prod97.0%
pow297.0%
+-commutative97.0%
Applied egg-rr97.0%
expm1-def97.0%
expm1-log1p99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (- (cbrt (+ 1.0 x)) (cbrt x))))
(if (<= t_0 2e-8)
(* 0.3333333333333333 (cbrt (/ 1.0 (* x x))))
(exp (log t_0)))))
double code(double x) {
double t_0 = cbrt((1.0 + x)) - cbrt(x);
double tmp;
if (t_0 <= 2e-8) {
tmp = 0.3333333333333333 * cbrt((1.0 / (x * x)));
} else {
tmp = exp(log(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 <= 2e-8) {
tmp = 0.3333333333333333 * Math.cbrt((1.0 / (x * x)));
} else {
tmp = Math.exp(Math.log(t_0));
}
return tmp;
}
function code(x) t_0 = Float64(cbrt(Float64(1.0 + x)) - cbrt(x)) tmp = 0.0 if (t_0 <= 2e-8) tmp = Float64(0.3333333333333333 * cbrt(Float64(1.0 / Float64(x * x)))); else tmp = exp(log(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, 2e-8], N[(0.3333333333333333 * N[Power[N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[Exp[N[Log[t$95$0], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x} - \sqrt[3]{x}\\
\mathbf{if}\;t_0 \leq 2 \cdot 10^{-8}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt[3]{\frac{1}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;e^{\log t_0}\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 2e-8Initial program 4.6%
add-sqr-sqrt2.7%
add-sqr-sqrt2.8%
difference-of-squares2.8%
pow1/32.8%
sqrt-pow12.8%
metadata-eval2.8%
pow1/32.8%
sqrt-pow12.8%
metadata-eval2.8%
pow1/31.5%
sqrt-pow11.5%
metadata-eval1.5%
pow1/32.9%
sqrt-pow12.8%
metadata-eval2.8%
Applied egg-rr2.8%
Taylor expanded in x around inf 54.3%
unpow1/358.2%
unpow258.2%
Simplified58.2%
if 2e-8 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 99.3%
add-exp-log99.3%
Applied egg-rr99.3%
Final simplification79.4%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ (cbrt x) (cbrt (+ 1.0 x)))))
(if (<= x 1.35e+154)
(/ (+ 1.0 (- x x)) (+ (cbrt (pow (+ 1.0 x) 2.0)) (* (cbrt x) t_0)))
(/ 1.0 (fma (cbrt x) t_0 (pow (+ 1.0 x) 0.6666666666666666))))))
double code(double x) {
double t_0 = cbrt(x) + cbrt((1.0 + x));
double tmp;
if (x <= 1.35e+154) {
tmp = (1.0 + (x - x)) / (cbrt(pow((1.0 + x), 2.0)) + (cbrt(x) * t_0));
} else {
tmp = 1.0 / fma(cbrt(x), t_0, pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
function code(x) t_0 = Float64(cbrt(x) + cbrt(Float64(1.0 + x))) tmp = 0.0 if (x <= 1.35e+154) tmp = Float64(Float64(1.0 + Float64(x - x)) / Float64(cbrt((Float64(1.0 + x) ^ 2.0)) + Float64(cbrt(x) * t_0))); else tmp = Float64(1.0 / fma(cbrt(x), 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[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.35e+154], N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Power[N[Power[N[(1.0 + x), $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * 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} + \sqrt[3]{1 + x}\\
\mathbf{if}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1 + \left(x - x\right)}{\sqrt[3]{{\left(1 + x\right)}^{2}} + \sqrt[3]{x} \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_0, {\left(1 + x\right)}^{0.6666666666666666}\right)}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 59.6%
flip3--59.6%
rem-cube-cbrt59.8%
rem-cube-cbrt60.9%
cbrt-unprod60.9%
pow260.9%
distribute-rgt-out60.9%
+-commutative60.9%
Applied egg-rr60.9%
+-commutative60.9%
associate--l+89.4%
Applied egg-rr89.4%
if 1.35000000000000003e154 < 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.7%
+-commutative91.7%
metadata-eval91.7%
Applied egg-rr91.7%
Final simplification89.6%
(FPCore (x)
:precision binary64
(if (<= x -1.0)
(* 0.3333333333333333 (cbrt (/ 1.0 (* x x))))
(/
1.0
(fma
(cbrt x)
(+ (cbrt x) (cbrt (+ 1.0 x)))
(pow (+ 1.0 x) 0.6666666666666666)))))
double code(double x) {
double tmp;
if (x <= -1.0) {
tmp = 0.3333333333333333 * cbrt((1.0 / (x * x)));
} else {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + cbrt((1.0 + x))), pow((1.0 + x), 0.6666666666666666));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= -1.0) tmp = Float64(0.3333333333333333 * cbrt(Float64(1.0 / Float64(x * x)))); else tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(Float64(1.0 + x))), (Float64(1.0 + x) ^ 0.6666666666666666))); end return tmp end
code[x_] := If[LessEqual[x, -1.0], N[(0.3333333333333333 * N[Power[N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], 0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt[3]{\frac{1}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, {\left(1 + x\right)}^{0.6666666666666666}\right)}\\
\end{array}
\end{array}
if x < -1Initial program 10.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
difference-of-squares0.0%
pow1/30.0%
sqrt-pow10.0%
metadata-eval0.0%
pow1/30.0%
sqrt-pow10.0%
metadata-eval0.0%
pow1/30.0%
sqrt-pow10.0%
metadata-eval0.0%
pow1/30.0%
sqrt-pow10.0%
metadata-eval0.0%
Applied egg-rr0.0%
Taylor expanded in x around inf 51.4%
unpow1/355.1%
unpow255.1%
Simplified55.1%
if -1 < x Initial program 66.1%
flip3--66.0%
div-inv66.0%
rem-cube-cbrt65.7%
rem-cube-cbrt66.9%
cbrt-unprod66.9%
pow266.9%
distribute-rgt-out66.9%
+-commutative66.9%
Applied egg-rr66.9%
associate-*r/66.9%
*-rgt-identity66.9%
+-commutative66.9%
associate--l+85.6%
+-inverses85.6%
metadata-eval85.6%
+-commutative85.6%
fma-def85.7%
+-commutative85.7%
+-commutative85.7%
Simplified85.7%
pow1/384.7%
+-commutative84.7%
pow-pow97.5%
+-commutative97.5%
metadata-eval97.5%
Applied egg-rr97.5%
Final simplification87.9%
(FPCore (x) :precision binary64 (let* ((t_0 (- (cbrt (+ 1.0 x)) (cbrt x)))) (if (<= t_0 2e-8) (* 0.3333333333333333 (cbrt (/ 1.0 (* x x)))) t_0)))
double code(double x) {
double t_0 = cbrt((1.0 + x)) - cbrt(x);
double tmp;
if (t_0 <= 2e-8) {
tmp = 0.3333333333333333 * cbrt((1.0 / (x * x)));
} 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 <= 2e-8) {
tmp = 0.3333333333333333 * Math.cbrt((1.0 / (x * x)));
} 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 <= 2e-8) tmp = Float64(0.3333333333333333 * cbrt(Float64(1.0 / Float64(x * x)))); 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, 2e-8], N[(0.3333333333333333 * N[Power[N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x} - \sqrt[3]{x}\\
\mathbf{if}\;t_0 \leq 2 \cdot 10^{-8}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt[3]{\frac{1}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 2e-8Initial program 4.6%
add-sqr-sqrt2.7%
add-sqr-sqrt2.8%
difference-of-squares2.8%
pow1/32.8%
sqrt-pow12.8%
metadata-eval2.8%
pow1/32.8%
sqrt-pow12.8%
metadata-eval2.8%
pow1/31.5%
sqrt-pow11.5%
metadata-eval1.5%
pow1/32.9%
sqrt-pow12.8%
metadata-eval2.8%
Applied egg-rr2.8%
Taylor expanded in x around inf 54.3%
unpow1/358.2%
unpow258.2%
Simplified58.2%
if 2e-8 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 99.3%
Final simplification79.4%
(FPCore (x) :precision binary64 (if (or (<= x -1.0) (not (<= x 0.47))) (* 0.3333333333333333 (cbrt (/ 1.0 (* x x)))) (- 1.0 (cbrt x))))
double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 0.47)) {
tmp = 0.3333333333333333 * cbrt((1.0 / (x * x)));
} else {
tmp = 1.0 - cbrt(x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 0.47)) {
tmp = 0.3333333333333333 * Math.cbrt((1.0 / (x * x)));
} else {
tmp = 1.0 - Math.cbrt(x);
}
return tmp;
}
function code(x) tmp = 0.0 if ((x <= -1.0) || !(x <= 0.47)) tmp = Float64(0.3333333333333333 * cbrt(Float64(1.0 / Float64(x * x)))); else tmp = Float64(1.0 - cbrt(x)); end return tmp end
code[x_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 0.47]], $MachinePrecision]], N[(0.3333333333333333 * N[Power[N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 0.47\right):\\
\;\;\;\;0.3333333333333333 \cdot \sqrt[3]{\frac{1}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt[3]{x}\\
\end{array}
\end{array}
if x < -1 or 0.46999999999999997 < x Initial program 8.3%
add-sqr-sqrt3.7%
add-sqr-sqrt3.8%
difference-of-squares3.8%
pow1/33.8%
sqrt-pow13.8%
metadata-eval3.8%
pow1/33.8%
sqrt-pow13.8%
metadata-eval3.8%
pow1/32.5%
sqrt-pow12.5%
metadata-eval2.5%
pow1/33.9%
sqrt-pow13.8%
metadata-eval3.8%
Applied egg-rr3.8%
Taylor expanded in x around inf 53.4%
unpow1/357.1%
unpow257.1%
Simplified57.1%
if -1 < x < 0.46999999999999997Initial program 100.0%
add-sqr-sqrt51.6%
pow251.6%
pow1/351.6%
sqrt-pow151.6%
metadata-eval51.6%
Applied egg-rr51.6%
Taylor expanded in x around 0 50.3%
unpow1/397.6%
Simplified97.6%
Final simplification77.0%
(FPCore (x) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (* 0.3333333333333333 (cbrt (/ 1.0 (* x x)))) (- (+ 1.0 (* x 0.3333333333333333)) (cbrt x))))
double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = 0.3333333333333333 * cbrt((1.0 / (x * x)));
} else {
tmp = (1.0 + (x * 0.3333333333333333)) - cbrt(x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = 0.3333333333333333 * Math.cbrt((1.0 / (x * x)));
} else {
tmp = (1.0 + (x * 0.3333333333333333)) - Math.cbrt(x);
}
return tmp;
}
function code(x) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(0.3333333333333333 * cbrt(Float64(1.0 / Float64(x * x)))); else tmp = Float64(Float64(1.0 + Float64(x * 0.3333333333333333)) - cbrt(x)); end return tmp end
code[x_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(0.3333333333333333 * N[Power[N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;0.3333333333333333 \cdot \sqrt[3]{\frac{1}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot 0.3333333333333333\right) - \sqrt[3]{x}\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 8.3%
add-sqr-sqrt3.7%
add-sqr-sqrt3.8%
difference-of-squares3.8%
pow1/33.8%
sqrt-pow13.8%
metadata-eval3.8%
pow1/33.8%
sqrt-pow13.8%
metadata-eval3.8%
pow1/32.5%
sqrt-pow12.5%
metadata-eval2.5%
pow1/33.9%
sqrt-pow13.8%
metadata-eval3.8%
Applied egg-rr3.8%
Taylor expanded in x around inf 53.4%
unpow1/357.1%
unpow257.1%
Simplified57.1%
if -1 < x < 1Initial program 100.0%
add-sqr-sqrt51.6%
pow251.6%
pow1/351.6%
sqrt-pow151.6%
metadata-eval51.6%
Applied egg-rr51.6%
Taylor expanded in x around 0 50.9%
*-commutative50.9%
unpow1/398.8%
Simplified98.8%
Final simplification77.6%
(FPCore (x) :precision binary64 (- 1.0 (cbrt x)))
double code(double x) {
return 1.0 - cbrt(x);
}
public static double code(double x) {
return 1.0 - Math.cbrt(x);
}
function code(x) return Float64(1.0 - cbrt(x)) end
code[x_] := N[(1.0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \sqrt[3]{x}
\end{array}
Initial program 53.4%
add-sqr-sqrt27.3%
pow227.3%
pow1/327.7%
sqrt-pow127.7%
metadata-eval27.7%
Applied egg-rr27.7%
Taylor expanded in x around 0 25.3%
unpow1/349.8%
Simplified49.8%
Final simplification49.8%
(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 49.0%
Final simplification49.0%
herbie shell --seed 2023196
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
(- (cbrt (+ x 1.0)) (cbrt x)))