
(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 9 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 (/ 1.0 (/ (cbrt (* 2.0 a)) (cbrt g))))
double code(double g, double a) {
return 1.0 / (cbrt((2.0 * a)) / cbrt(g));
}
public static double code(double g, double a) {
return 1.0 / (Math.cbrt((2.0 * a)) / Math.cbrt(g));
}
function code(g, a) return Float64(1.0 / Float64(cbrt(Float64(2.0 * a)) / cbrt(g))) end
code[g_, a_] := N[(1.0 / N[(N[Power[N[(2.0 * a), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[g, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{\sqrt[3]{2 \cdot a}}{\sqrt[3]{g}}}
\end{array}
Initial program 78.6%
cbrt-div98.7%
clear-num98.8%
Applied egg-rr98.8%
Final simplification98.8%
(FPCore (g a) :precision binary64 (* (cbrt g) (cbrt (/ 0.5 a))))
double code(double g, double a) {
return cbrt(g) * cbrt((0.5 / a));
}
public static double code(double g, double a) {
return Math.cbrt(g) * Math.cbrt((0.5 / a));
}
function code(g, a) return Float64(cbrt(g) * cbrt(Float64(0.5 / a))) end
code[g_, a_] := N[(N[Power[g, 1/3], $MachinePrecision] * N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{g} \cdot \sqrt[3]{\frac{0.5}{a}}
\end{array}
Initial program 78.6%
div-inv78.6%
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 (* 2.0 a))))
double code(double g, double a) {
return cbrt(g) / cbrt((2.0 * a));
}
public static double code(double g, double a) {
return Math.cbrt(g) / Math.cbrt((2.0 * a));
}
function code(g, a) return Float64(cbrt(g) / cbrt(Float64(2.0 * a))) end
code[g_, a_] := N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[N[(2.0 * a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt[3]{g}}{\sqrt[3]{2 \cdot a}}
\end{array}
Initial program 78.6%
cbrt-div98.7%
div-inv98.7%
Applied egg-rr98.7%
associate-*r/98.7%
*-rgt-identity98.7%
*-commutative98.7%
Simplified98.7%
Final simplification98.7%
(FPCore (g a) :precision binary64 (/ 1.0 (cbrt (/ (+ a a) g))))
double code(double g, double a) {
return 1.0 / cbrt(((a + a) / g));
}
public static double code(double g, double a) {
return 1.0 / Math.cbrt(((a + a) / g));
}
function code(g, a) return Float64(1.0 / cbrt(Float64(Float64(a + a) / g))) end
code[g_, a_] := N[(1.0 / N[Power[N[(N[(a + a), $MachinePrecision] / g), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt[3]{\frac{a + a}{g}}}
\end{array}
Initial program 78.6%
clear-num78.0%
cbrt-div78.7%
metadata-eval78.7%
*-un-lft-identity78.7%
times-frac78.6%
metadata-eval78.6%
Applied egg-rr78.6%
associate-*r/78.7%
associate-*l/78.4%
Simplified78.4%
associate-*l/78.7%
add-log-exp4.0%
*-commutative4.0%
exp-lft-sqr3.9%
log-prod3.9%
add-log-exp10.9%
add-log-exp78.7%
Applied egg-rr78.7%
Final simplification78.7%
(FPCore (g a) :precision binary64 (cbrt (* g (/ 0.5 a))))
double code(double g, double a) {
return cbrt((g * (0.5 / a)));
}
public static double code(double g, double a) {
return Math.cbrt((g * (0.5 / a)));
}
function code(g, a) return cbrt(Float64(g * Float64(0.5 / a))) end
code[g_, a_] := N[Power[N[(g * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{g \cdot \frac{0.5}{a}}
\end{array}
Initial program 78.6%
expm1-log1p-u56.4%
expm1-udef23.9%
log1p-udef23.9%
add-exp-log46.2%
*-un-lft-identity46.2%
times-frac46.2%
metadata-eval46.2%
Applied egg-rr46.2%
+-commutative46.2%
associate--l+78.6%
metadata-eval78.6%
+-rgt-identity78.6%
associate-*r/78.6%
associate-*l/78.6%
Simplified78.6%
Final simplification78.6%
(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}
Initial program 78.6%
Final simplification78.6%
(FPCore (g a) :precision binary64 (cbrt (/ (* g 0.5) a)))
double code(double g, double a) {
return cbrt(((g * 0.5) / a));
}
public static double code(double g, double a) {
return Math.cbrt(((g * 0.5) / a));
}
function code(g, a) return cbrt(Float64(Float64(g * 0.5) / a)) end
code[g_, a_] := N[Power[N[(N[(g * 0.5), $MachinePrecision] / a), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{g \cdot 0.5}{a}}
\end{array}
Initial program 78.6%
expm1-log1p-u56.4%
expm1-udef23.9%
log1p-udef23.9%
add-exp-log46.2%
*-un-lft-identity46.2%
times-frac46.2%
metadata-eval46.2%
Applied egg-rr46.2%
+-commutative46.2%
associate--l+78.6%
metadata-eval78.6%
+-rgt-identity78.6%
associate-*r/78.6%
associate-*l/78.6%
Simplified78.6%
*-commutative78.6%
associate-*r/78.6%
Applied egg-rr78.6%
Final simplification78.6%
(FPCore (g a) :precision binary64 (cbrt (/ g a)))
double code(double g, double a) {
return cbrt((g / a));
}
public static double code(double g, double a) {
return Math.cbrt((g / a));
}
function code(g, a) return cbrt(Float64(g / a)) end
code[g_, a_] := N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\frac{g}{a}}
\end{array}
Initial program 78.6%
cbrt-div98.7%
clear-num98.8%
Applied egg-rr98.8%
*-commutative98.8%
associate-/l*98.7%
add-cube-cbrt97.7%
times-frac97.7%
Applied egg-rr97.7%
times-frac97.7%
*-lft-identity97.7%
unpow297.7%
rem-3cbrt-lft98.7%
Simplified98.7%
flip-+0.0%
difference-of-squares0.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
metadata-eval0.0%
associate-*r/0.0%
metadata-eval0.0%
+-inverses0.0%
difference-of-squares0.0%
+-inverses0.0%
metadata-eval0.0%
associate-*r/0.0%
metadata-eval0.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
flip-+5.4%
associate-*l*5.4%
add-cbrt-cube6.4%
add-cube-cbrt6.4%
add-cube-cbrt6.4%
Applied egg-rr6.4%
Simplified21.3%
expm1-log1p-u15.5%
expm1-udef8.2%
cbrt-undiv7.4%
Applied egg-rr7.4%
expm1-def12.9%
expm1-log1p17.7%
Simplified17.7%
Final simplification17.7%
(FPCore (g a) :precision binary64 (cbrt -2.0))
double code(double g, double a) {
return cbrt(-2.0);
}
public static double code(double g, double a) {
return Math.cbrt(-2.0);
}
function code(g, a) return cbrt(-2.0) end
code[g_, a_] := N[Power[-2.0, 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{-2}
\end{array}
Initial program 78.6%
expm1-log1p-u56.4%
expm1-udef23.9%
log1p-udef23.9%
add-exp-log46.2%
*-un-lft-identity46.2%
times-frac46.2%
metadata-eval46.2%
Applied egg-rr46.2%
+-commutative46.2%
associate--l+78.6%
metadata-eval78.6%
+-rgt-identity78.6%
associate-*r/78.6%
associate-*l/78.6%
Simplified78.6%
associate-*l/78.6%
associate-/l*78.0%
Applied egg-rr78.0%
Taylor expanded in a around 0 78.6%
Simplified4.6%
Final simplification4.6%
herbie shell --seed 2023222
(FPCore (g a)
:name "2-ancestry mixing, zero discriminant"
:precision binary64
(cbrt (/ g (* 2.0 a))))