
(FPCore (g a) :precision binary64 (cbrt (/ g (* 2.0 a))))
double code(double g, double a) {
return cbrt((g / (2.0 * a)));
}
public static double code(double g, double a) {
return Math.cbrt((g / (2.0 * a)));
}
function code(g, a) return cbrt(Float64(g / Float64(2.0 * a))) end
code[g_, a_] := N[Power[N[(g / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{g}{2 \cdot a}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 5 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (g a) :precision binary64 (cbrt (/ g (* 2.0 a))))
double code(double g, double a) {
return cbrt((g / (2.0 * a)));
}
public static double code(double g, double a) {
return Math.cbrt((g / (2.0 * a)));
}
function code(g, a) return cbrt(Float64(g / Float64(2.0 * a))) end
code[g_, a_] := N[Power[N[(g / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{g}{2 \cdot a}}
\end{array}
(FPCore (g a) :precision binary64 (/ (cbrt (/ 0.5 a)) (cbrt (/ 1.0 g))))
double code(double g, double a) {
return cbrt((0.5 / a)) / cbrt((1.0 / g));
}
public static double code(double g, double a) {
return Math.cbrt((0.5 / a)) / Math.cbrt((1.0 / g));
}
function code(g, a) return Float64(cbrt(Float64(0.5 / a)) / cbrt(Float64(1.0 / g))) end
code[g_, a_] := N[(N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[N[(1.0 / g), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt[3]{\frac{0.5}{a}}}{\sqrt[3]{\frac{1}{g}}}
\end{array}
Initial program 71.2%
expm1-log1p-u56.4%
expm1-udef26.8%
log1p-udef26.8%
add-exp-log41.6%
*-un-lft-identity41.6%
times-frac41.6%
metadata-eval41.6%
Applied egg-rr41.6%
+-commutative41.6%
associate--l+71.2%
metadata-eval71.2%
+-rgt-identity71.2%
associate-*r/71.2%
associate-*l/71.2%
Simplified71.2%
associate-*l/71.2%
*-un-lft-identity71.2%
times-frac71.2%
metadata-eval71.2%
metadata-eval71.2%
times-frac71.2%
*-un-lft-identity71.2%
*-commutative71.2%
cbrt-undiv98.8%
clear-num98.8%
div-inv98.7%
associate-/r*98.6%
clear-num98.6%
metadata-eval98.6%
/-rgt-identity98.6%
metadata-eval98.6%
div-inv98.6%
cbrt-div98.7%
clear-num98.7%
Applied egg-rr98.7%
expm1-log1p-u71.5%
expm1-udef30.8%
Applied egg-rr30.8%
expm1-def71.5%
expm1-log1p98.7%
rem-cbrt-cube98.5%
cube-div98.5%
metadata-eval98.5%
rem-cube-cbrt98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (g a) :precision binary64 (/ 1.0 (/ (cbrt (* a 2.0)) (cbrt g))))
double code(double g, double a) {
return 1.0 / (cbrt((a * 2.0)) / cbrt(g));
}
public static double code(double g, double a) {
return 1.0 / (Math.cbrt((a * 2.0)) / Math.cbrt(g));
}
function code(g, a) return Float64(1.0 / Float64(cbrt(Float64(a * 2.0)) / cbrt(g))) end
code[g_, a_] := N[(1.0 / N[(N[Power[N[(a * 2.0), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[g, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{\sqrt[3]{a \cdot 2}}{\sqrt[3]{g}}}
\end{array}
Initial program 71.2%
cbrt-div98.8%
clear-num98.8%
Applied egg-rr98.8%
Final simplification98.8%
(FPCore (g a) :precision binary64 (* (cbrt (/ 0.5 a)) (cbrt g)))
double code(double g, double a) {
return cbrt((0.5 / a)) * cbrt(g);
}
public static double code(double g, double a) {
return Math.cbrt((0.5 / a)) * Math.cbrt(g);
}
function code(g, a) return Float64(cbrt(Float64(0.5 / a)) * cbrt(g)) end
code[g_, a_] := N[(N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[g, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{0.5}{a}} \cdot \sqrt[3]{g}
\end{array}
Initial program 71.2%
div-inv71.2%
cbrt-prod98.7%
associate-/r*98.7%
metadata-eval98.7%
Applied egg-rr98.7%
Final simplification98.7%
(FPCore (g a) :precision binary64 (/ (cbrt g) (cbrt (* a 2.0))))
double code(double g, double a) {
return cbrt(g) / cbrt((a * 2.0));
}
public static double code(double g, double a) {
return Math.cbrt(g) / Math.cbrt((a * 2.0));
}
function code(g, a) return Float64(cbrt(g) / cbrt(Float64(a * 2.0))) end
code[g_, a_] := N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[N[(a * 2.0), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt[3]{g}}{\sqrt[3]{a \cdot 2}}
\end{array}
Initial program 71.2%
cbrt-div98.8%
div-inv98.7%
Applied egg-rr98.7%
associate-*r/98.8%
*-rgt-identity98.8%
*-commutative98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (g a) :precision binary64 (cbrt (* (/ 0.5 a) g)))
double code(double g, double a) {
return cbrt(((0.5 / a) * g));
}
public static double code(double g, double a) {
return Math.cbrt(((0.5 / a) * g));
}
function code(g, a) return cbrt(Float64(Float64(0.5 / a) * g)) end
code[g_, a_] := N[Power[N[(N[(0.5 / a), $MachinePrecision] * g), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{0.5}{a} \cdot g}
\end{array}
Initial program 71.2%
expm1-log1p-u56.4%
expm1-udef26.8%
log1p-udef26.8%
add-exp-log41.6%
*-un-lft-identity41.6%
times-frac41.6%
metadata-eval41.6%
Applied egg-rr41.6%
+-commutative41.6%
associate--l+71.2%
metadata-eval71.2%
+-rgt-identity71.2%
associate-*r/71.2%
associate-*l/71.2%
Simplified71.2%
Final simplification71.2%
herbie shell --seed 2023187
(FPCore (g a)
:name "2-ancestry mixing, zero discriminant"
:precision binary64
(cbrt (/ g (* 2.0 a))))