
(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 10 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)
(/ (+ x (+ 1.0 x)) (+ (pow t_0 2.0) (* (cbrt x) (- (cbrt x) t_0))))
(* t_0 t_0)))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / fma(cbrt(x), ((x + (1.0 + x)) / (pow(t_0, 2.0) + (cbrt(x) * (cbrt(x) - t_0)))), (t_0 * t_0));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / fma(cbrt(x), Float64(Float64(x + Float64(1.0 + x)) / Float64((t_0 ^ 2.0) + Float64(cbrt(x) * Float64(cbrt(x) - t_0)))), Float64(t_0 * 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[x, 1/3], $MachinePrecision] * N[(N[(x + N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / 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] + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \frac{x + \left(1 + x\right)}{{t\_0}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} - t\_0\right)}, t\_0 \cdot t\_0\right)}
\end{array}
\end{array}
Initial program 7.8%
flip3--7.8%
div-inv7.8%
rem-cube-cbrt7.2%
rem-cube-cbrt10.5%
+-commutative10.5%
distribute-rgt-out10.5%
+-commutative10.5%
fma-define10.5%
add-exp-log10.4%
Applied egg-rr10.4%
associate-*r/10.4%
*-rgt-identity10.4%
+-commutative10.4%
associate--l+93.3%
+-inverses93.3%
metadata-eval93.3%
+-commutative93.3%
exp-prod92.3%
Simplified92.3%
pow-exp93.3%
*-commutative93.3%
log1p-undefine93.3%
+-commutative93.3%
exp-to-pow93.1%
metadata-eval93.1%
metadata-eval93.1%
pow-sqr93.1%
metadata-eval93.1%
pow1/394.6%
metadata-eval94.6%
pow1/398.6%
Applied egg-rr98.6%
add-sqr-sqrt98.6%
pow298.6%
+-commutative98.6%
+-commutative98.6%
Applied egg-rr98.6%
unpow298.6%
add-sqr-sqrt98.6%
+-commutative98.6%
flip3-+98.5%
rem-cube-cbrt99.0%
rem-cube-cbrt99.5%
+-commutative99.5%
pow299.5%
distribute-rgt-out--99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (+ 1.0 x))))
(/
1.0
(fma
(cbrt x)
(+ (cbrt x) t_0)
(* t_0 (cbrt (pow (sqrt (+ 1.0 x)) 2.0)))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / fma(cbrt(x), (cbrt(x) + t_0), (t_0 * cbrt(pow(sqrt((1.0 + x)), 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(t_0 * cbrt((sqrt(Float64(1.0 + x)) ^ 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[(t$95$0 * N[Power[N[Power[N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision]), $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 \cdot \sqrt[3]{{\left(\sqrt{1 + x}\right)}^{2}}\right)}
\end{array}
\end{array}
Initial program 7.8%
flip3--7.8%
div-inv7.8%
rem-cube-cbrt7.2%
rem-cube-cbrt10.5%
+-commutative10.5%
distribute-rgt-out10.5%
+-commutative10.5%
fma-define10.5%
add-exp-log10.4%
Applied egg-rr10.4%
associate-*r/10.4%
*-rgt-identity10.4%
+-commutative10.4%
associate--l+93.3%
+-inverses93.3%
metadata-eval93.3%
+-commutative93.3%
exp-prod92.3%
Simplified92.3%
pow-exp93.3%
*-commutative93.3%
log1p-undefine93.3%
+-commutative93.3%
exp-to-pow93.1%
metadata-eval93.1%
metadata-eval93.1%
pow-sqr93.1%
metadata-eval93.1%
pow1/394.6%
metadata-eval94.6%
pow1/398.6%
Applied egg-rr98.6%
add-sqr-sqrt98.6%
pow298.6%
Applied egg-rr98.6%
Final simplification98.6%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x)))) (/ 1.0 (fma (cbrt x) (+ (cbrt x) t_0) (* t_0 (cbrt (pow t_0 3.0)))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / fma(cbrt(x), (cbrt(x) + t_0), (t_0 * cbrt(pow(t_0, 3.0))));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), Float64(t_0 * cbrt((t_0 ^ 3.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[(t$95$0 * N[Power[N[Power[t$95$0, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $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 \cdot \sqrt[3]{{t\_0}^{3}}\right)}
\end{array}
\end{array}
Initial program 7.8%
flip3--7.8%
div-inv7.8%
rem-cube-cbrt7.2%
rem-cube-cbrt10.5%
+-commutative10.5%
distribute-rgt-out10.5%
+-commutative10.5%
fma-define10.5%
add-exp-log10.4%
Applied egg-rr10.4%
associate-*r/10.4%
*-rgt-identity10.4%
+-commutative10.4%
associate--l+93.3%
+-inverses93.3%
metadata-eval93.3%
+-commutative93.3%
exp-prod92.3%
Simplified92.3%
pow-exp93.3%
*-commutative93.3%
log1p-undefine93.3%
+-commutative93.3%
exp-to-pow93.1%
metadata-eval93.1%
metadata-eval93.1%
pow-sqr93.1%
metadata-eval93.1%
pow1/394.6%
metadata-eval94.6%
pow1/398.6%
Applied egg-rr98.6%
rem-cube-cbrt98.6%
Applied egg-rr98.6%
Final simplification98.6%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x)))) (/ 1.0 (fma (cbrt x) (+ (cbrt x) t_0) (* t_0 t_0)))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return 1.0 / fma(cbrt(x), (cbrt(x) + t_0), (t_0 * t_0));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), Float64(t_0 * 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[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision] + N[(t$95$0 * t$95$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 \cdot t\_0\right)}
\end{array}
\end{array}
Initial program 7.8%
flip3--7.8%
div-inv7.8%
rem-cube-cbrt7.2%
rem-cube-cbrt10.5%
+-commutative10.5%
distribute-rgt-out10.5%
+-commutative10.5%
fma-define10.5%
add-exp-log10.4%
Applied egg-rr10.4%
associate-*r/10.4%
*-rgt-identity10.4%
+-commutative10.4%
associate--l+93.3%
+-inverses93.3%
metadata-eval93.3%
+-commutative93.3%
exp-prod92.3%
Simplified92.3%
pow-exp93.3%
*-commutative93.3%
log1p-undefine93.3%
+-commutative93.3%
exp-to-pow93.1%
metadata-eval93.1%
metadata-eval93.1%
pow-sqr93.1%
metadata-eval93.1%
pow1/394.6%
metadata-eval94.6%
pow1/398.6%
Applied egg-rr98.6%
Final simplification98.6%
(FPCore (x)
:precision binary64
(if (<= x 2e+41)
(/
1.0
(+ (* (cbrt x) (+ (cbrt x) (cbrt (+ 1.0 x)))) (cbrt (pow (+ 1.0 x) 2.0))))
(/ 1.0 (* x (* 3.0 (cbrt (/ 1.0 x)))))))
double code(double x) {
double tmp;
if (x <= 2e+41) {
tmp = 1.0 / ((cbrt(x) * (cbrt(x) + cbrt((1.0 + x)))) + cbrt(pow((1.0 + x), 2.0)));
} else {
tmp = 1.0 / (x * (3.0 * cbrt((1.0 / x))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 2e+41) {
tmp = 1.0 / ((Math.cbrt(x) * (Math.cbrt(x) + Math.cbrt((1.0 + x)))) + Math.cbrt(Math.pow((1.0 + x), 2.0)));
} else {
tmp = 1.0 / (x * (3.0 * Math.cbrt((1.0 / x))));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 2e+41) tmp = Float64(1.0 / Float64(Float64(cbrt(x) * Float64(cbrt(x) + cbrt(Float64(1.0 + x)))) + cbrt((Float64(1.0 + x) ^ 2.0)))); else tmp = Float64(1.0 / Float64(x * Float64(3.0 * cbrt(Float64(1.0 / x))))); end return tmp end
code[x_] := If[LessEqual[x, 2e+41], N[(1.0 / N[(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]), $MachinePrecision] + N[Power[N[Power[N[(1.0 + x), $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(x * N[(3.0 * N[Power[N[(1.0 / x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{+41}:\\
\;\;\;\;\frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right) + \sqrt[3]{{\left(1 + x\right)}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(3 \cdot \sqrt[3]{\frac{1}{x}}\right)}\\
\end{array}
\end{array}
if x < 2.00000000000000001e41Initial program 26.0%
flip3--26.6%
div-inv26.6%
rem-cube-cbrt27.4%
rem-cube-cbrt42.9%
+-commutative42.9%
distribute-rgt-out42.9%
+-commutative42.9%
fma-define43.0%
add-exp-log42.7%
Applied egg-rr42.6%
associate-*r/42.6%
*-rgt-identity42.6%
+-commutative42.6%
associate--l+96.5%
+-inverses96.5%
metadata-eval96.5%
+-commutative96.5%
exp-prod96.1%
Simplified96.1%
pow-exp96.5%
*-commutative96.5%
log1p-undefine96.5%
+-commutative96.5%
exp-to-pow96.8%
metadata-eval96.8%
metadata-eval96.8%
pow-sqr96.8%
metadata-eval96.8%
pow1/397.8%
metadata-eval97.8%
pow1/398.8%
Applied egg-rr98.8%
fma-undefine98.7%
+-commutative98.7%
+-commutative98.7%
+-commutative98.7%
cbrt-unprod98.8%
pow298.8%
Applied egg-rr98.8%
if 2.00000000000000001e41 < x Initial program 4.3%
flip3--4.3%
div-inv4.3%
rem-cube-cbrt3.3%
rem-cube-cbrt4.3%
+-commutative4.3%
distribute-rgt-out4.3%
+-commutative4.3%
fma-define4.3%
add-exp-log4.3%
Applied egg-rr4.3%
associate-*r/4.3%
*-rgt-identity4.3%
+-commutative4.3%
associate--l+92.7%
+-inverses92.7%
metadata-eval92.7%
+-commutative92.7%
exp-prod91.6%
Simplified91.6%
Taylor expanded in x around inf 91.6%
Taylor expanded in x around inf 98.8%
distribute-rgt1-in98.8%
metadata-eval98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x)
:precision binary64
(if (<= x 1e+15)
(/
1.0
(fma
(cbrt x)
(+ (cbrt x) (cbrt (+ 1.0 x)))
(pow (+ 1.0 x) 0.6666666666666666)))
(/ 1.0 (* x (* 3.0 (cbrt (/ 1.0 x)))))))
double code(double x) {
double tmp;
if (x <= 1e+15) {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + cbrt((1.0 + x))), pow((1.0 + x), 0.6666666666666666));
} else {
tmp = 1.0 / (x * (3.0 * cbrt((1.0 / x))));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1e+15) tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(Float64(1.0 + x))), (Float64(1.0 + x) ^ 0.6666666666666666))); else tmp = Float64(1.0 / Float64(x * Float64(3.0 * cbrt(Float64(1.0 / x))))); end return tmp end
code[x_] := If[LessEqual[x, 1e+15], 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], N[(1.0 / N[(x * N[(3.0 * N[Power[N[(1.0 / x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{+15}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, {\left(1 + x\right)}^{0.6666666666666666}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(3 \cdot \sqrt[3]{\frac{1}{x}}\right)}\\
\end{array}
\end{array}
if x < 1e15Initial program 60.5%
flip3--61.8%
div-inv61.8%
rem-cube-cbrt62.8%
rem-cube-cbrt98.7%
+-commutative98.7%
distribute-rgt-out98.7%
+-commutative98.7%
fma-define98.9%
add-exp-log98.4%
Applied egg-rr98.1%
associate-*r/98.1%
*-rgt-identity98.1%
+-commutative98.1%
associate--l+98.1%
+-inverses98.1%
metadata-eval98.1%
+-commutative98.1%
exp-prod97.8%
Simplified97.8%
pow-exp98.1%
*-commutative98.1%
log1p-undefine98.1%
+-commutative98.1%
exp-to-pow98.1%
metadata-eval98.1%
metadata-eval98.1%
pow-sqr98.1%
metadata-eval98.1%
pow1/398.5%
metadata-eval98.5%
pow1/398.9%
Applied egg-rr98.9%
pow298.9%
pow1/398.1%
pow-pow98.1%
metadata-eval98.1%
Applied egg-rr98.1%
if 1e15 < x Initial program 4.2%
flip3--4.2%
div-inv4.2%
rem-cube-cbrt3.5%
rem-cube-cbrt4.6%
+-commutative4.6%
distribute-rgt-out4.6%
+-commutative4.6%
fma-define4.6%
add-exp-log4.6%
Applied egg-rr4.6%
associate-*r/4.6%
*-rgt-identity4.6%
+-commutative4.6%
associate--l+93.0%
+-inverses93.0%
metadata-eval93.0%
+-commutative93.0%
exp-prod91.9%
Simplified91.9%
Taylor expanded in x around inf 91.9%
Taylor expanded in x around inf 98.8%
distribute-rgt1-in98.8%
metadata-eval98.8%
Simplified98.8%
Final simplification98.7%
(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 7.8%
flip3--7.8%
div-inv7.8%
rem-cube-cbrt7.2%
rem-cube-cbrt10.5%
+-commutative10.5%
distribute-rgt-out10.5%
+-commutative10.5%
fma-define10.5%
add-exp-log10.4%
Applied egg-rr10.4%
associate-*r/10.4%
*-rgt-identity10.4%
+-commutative10.4%
associate--l+93.3%
+-inverses93.3%
metadata-eval93.3%
+-commutative93.3%
exp-prod92.3%
Simplified92.3%
pow-exp93.3%
*-commutative93.3%
log1p-undefine93.3%
+-commutative93.3%
exp-to-pow93.1%
metadata-eval93.1%
metadata-eval93.1%
pow-sqr93.1%
metadata-eval93.1%
pow1/394.6%
metadata-eval94.6%
pow1/398.6%
Applied egg-rr98.6%
add-sqr-sqrt98.6%
pow298.6%
Applied egg-rr98.6%
+-commutative98.6%
+-commutative98.6%
add-sqr-sqrt98.6%
unpow298.6%
unpow298.6%
add-sqr-sqrt98.6%
fma-undefine98.6%
+-commutative98.6%
pow298.6%
unpow298.6%
add-sqr-sqrt98.5%
Applied egg-rr98.5%
Final simplification98.5%
(FPCore (x) :precision binary64 (/ 1.0 (* x (* 3.0 (cbrt (/ 1.0 x))))))
double code(double x) {
return 1.0 / (x * (3.0 * cbrt((1.0 / x))));
}
public static double code(double x) {
return 1.0 / (x * (3.0 * Math.cbrt((1.0 / x))));
}
function code(x) return Float64(1.0 / Float64(x * Float64(3.0 * cbrt(Float64(1.0 / x))))) end
code[x_] := N[(1.0 / N[(x * N[(3.0 * N[Power[N[(1.0 / x), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x \cdot \left(3 \cdot \sqrt[3]{\frac{1}{x}}\right)}
\end{array}
Initial program 7.8%
flip3--7.8%
div-inv7.8%
rem-cube-cbrt7.2%
rem-cube-cbrt10.5%
+-commutative10.5%
distribute-rgt-out10.5%
+-commutative10.5%
fma-define10.5%
add-exp-log10.4%
Applied egg-rr10.4%
associate-*r/10.4%
*-rgt-identity10.4%
+-commutative10.4%
associate--l+93.3%
+-inverses93.3%
metadata-eval93.3%
+-commutative93.3%
exp-prod92.3%
Simplified92.3%
Taylor expanded in x around inf 90.0%
Taylor expanded in x around inf 96.3%
distribute-rgt1-in96.3%
metadata-eval96.3%
Simplified96.3%
(FPCore (x) :precision binary64 (* (cbrt x) (/ 0.25 x)))
double code(double x) {
return cbrt(x) * (0.25 / x);
}
public static double code(double x) {
return Math.cbrt(x) * (0.25 / x);
}
function code(x) return Float64(cbrt(x) * Float64(0.25 / x)) end
code[x_] := N[(N[Power[x, 1/3], $MachinePrecision] * N[(0.25 / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{x} \cdot \frac{0.25}{x}
\end{array}
Initial program 7.8%
flip3--7.8%
div-inv7.8%
rem-cube-cbrt7.2%
rem-cube-cbrt10.5%
+-commutative10.5%
distribute-rgt-out10.5%
+-commutative10.5%
fma-define10.5%
add-exp-log10.4%
Applied egg-rr10.4%
associate-*r/10.4%
*-rgt-identity10.4%
+-commutative10.4%
associate--l+93.3%
+-inverses93.3%
metadata-eval93.3%
+-commutative93.3%
exp-prod92.3%
Simplified92.3%
Taylor expanded in x around inf 90.0%
Taylor expanded in x around inf 20.8%
distribute-rgt-out20.8%
metadata-eval20.8%
Simplified20.8%
associate-/l*20.8%
*-commutative20.8%
Applied egg-rr20.8%
Final simplification20.8%
(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 7.8%
Taylor expanded in x around 0 1.8%
sub-neg1.8%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt5.5%
fabs-neg5.5%
unpow1/35.5%
metadata-eval5.5%
pow-sqr5.5%
fabs-sqr5.5%
pow-sqr5.5%
metadata-eval5.5%
unpow1/35.5%
Simplified5.5%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ x 1.0)))) (/ 1.0 (+ (+ (* t_0 t_0) (* (cbrt x) t_0)) (* (cbrt x) (cbrt x))))))
double code(double x) {
double t_0 = cbrt((x + 1.0));
return 1.0 / (((t_0 * t_0) + (cbrt(x) * t_0)) + (cbrt(x) * cbrt(x)));
}
public static double code(double x) {
double t_0 = Math.cbrt((x + 1.0));
return 1.0 / (((t_0 * t_0) + (Math.cbrt(x) * t_0)) + (Math.cbrt(x) * Math.cbrt(x)));
}
function code(x) t_0 = cbrt(Float64(x + 1.0)) return Float64(1.0 / Float64(Float64(Float64(t_0 * t_0) + Float64(cbrt(x) * t_0)) + Float64(cbrt(x) * cbrt(x)))) end
code[x_] := Block[{t$95$0 = N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision]}, N[(1.0 / N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{x + 1}\\
\frac{1}{\left(t\_0 \cdot t\_0 + \sqrt[3]{x} \cdot t\_0\right) + \sqrt[3]{x} \cdot \sqrt[3]{x}}
\end{array}
\end{array}
herbie shell --seed 2024114
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
:pre (and (> x 1.0) (< x 1e+308))
:alt
(/ 1.0 (+ (+ (* (cbrt (+ x 1.0)) (cbrt (+ x 1.0))) (* (cbrt x) (cbrt (+ x 1.0)))) (* (cbrt x) (cbrt x))))
(- (cbrt (+ x 1.0)) (cbrt x)))