
(FPCore (g h a) :precision binary64 (let* ((t_0 (/ 1.0 (* 2.0 a))) (t_1 (sqrt (- (* g g) (* h h))))) (+ (cbrt (* t_0 (+ (- g) t_1))) (cbrt (* t_0 (- (- g) t_1))))))
double code(double g, double h, double a) {
double t_0 = 1.0 / (2.0 * a);
double t_1 = sqrt(((g * g) - (h * h)));
return cbrt((t_0 * (-g + t_1))) + cbrt((t_0 * (-g - t_1)));
}
public static double code(double g, double h, double a) {
double t_0 = 1.0 / (2.0 * a);
double t_1 = Math.sqrt(((g * g) - (h * h)));
return Math.cbrt((t_0 * (-g + t_1))) + Math.cbrt((t_0 * (-g - t_1)));
}
function code(g, h, a) t_0 = Float64(1.0 / Float64(2.0 * a)) t_1 = sqrt(Float64(Float64(g * g) - Float64(h * h))) return Float64(cbrt(Float64(t_0 * Float64(Float64(-g) + t_1))) + cbrt(Float64(t_0 * Float64(Float64(-g) - t_1)))) end
code[g_, h_, a_] := Block[{t$95$0 = N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[(t$95$0 * N[((-g) + t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(t$95$0 * N[((-g) - t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{2 \cdot a}\\
t_1 := \sqrt{g \cdot g - h \cdot h}\\
\sqrt[3]{t\_0 \cdot \left(\left(-g\right) + t\_1\right)} + \sqrt[3]{t\_0 \cdot \left(\left(-g\right) - t\_1\right)}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (g h a) :precision binary64 (let* ((t_0 (/ 1.0 (* 2.0 a))) (t_1 (sqrt (- (* g g) (* h h))))) (+ (cbrt (* t_0 (+ (- g) t_1))) (cbrt (* t_0 (- (- g) t_1))))))
double code(double g, double h, double a) {
double t_0 = 1.0 / (2.0 * a);
double t_1 = sqrt(((g * g) - (h * h)));
return cbrt((t_0 * (-g + t_1))) + cbrt((t_0 * (-g - t_1)));
}
public static double code(double g, double h, double a) {
double t_0 = 1.0 / (2.0 * a);
double t_1 = Math.sqrt(((g * g) - (h * h)));
return Math.cbrt((t_0 * (-g + t_1))) + Math.cbrt((t_0 * (-g - t_1)));
}
function code(g, h, a) t_0 = Float64(1.0 / Float64(2.0 * a)) t_1 = sqrt(Float64(Float64(g * g) - Float64(h * h))) return Float64(cbrt(Float64(t_0 * Float64(Float64(-g) + t_1))) + cbrt(Float64(t_0 * Float64(Float64(-g) - t_1)))) end
code[g_, h_, a_] := Block[{t$95$0 = N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[(t$95$0 * N[((-g) + t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(t$95$0 * N[((-g) - t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{2 \cdot a}\\
t_1 := \sqrt{g \cdot g - h \cdot h}\\
\sqrt[3]{t\_0 \cdot \left(\left(-g\right) + t\_1\right)} + \sqrt[3]{t\_0 \cdot \left(\left(-g\right) - t\_1\right)}
\end{array}
\end{array}
(FPCore (g h a) :precision binary64 (+ (/ (cbrt g) (cbrt (- a))) (cbrt (* (- g g) (/ -0.5 a)))))
double code(double g, double h, double a) {
return (cbrt(g) / cbrt(-a)) + cbrt(((g - g) * (-0.5 / a)));
}
public static double code(double g, double h, double a) {
return (Math.cbrt(g) / Math.cbrt(-a)) + Math.cbrt(((g - g) * (-0.5 / a)));
}
function code(g, h, a) return Float64(Float64(cbrt(g) / cbrt(Float64(-a))) + cbrt(Float64(Float64(g - g) * Float64(-0.5 / a)))) end
code[g_, h_, a_] := N[(N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[(-a), 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[N[(N[(g - g), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sqrt[3]{g}}{\sqrt[3]{-a}} + \sqrt[3]{\left(g - g\right) \cdot \frac{-0.5}{a}}
\end{array}
Initial program 49.4%
Simplified49.4%
Taylor expanded in g around -inf 28.2%
*-commutative28.2%
Simplified28.2%
Taylor expanded in g around -inf 74.7%
neg-mul-174.7%
Simplified74.7%
associate-*l/74.7%
frac-2neg74.7%
*-commutative74.7%
associate-*r*74.7%
metadata-eval74.7%
neg-mul-174.7%
add-sqr-sqrt34.1%
sqrt-unprod22.5%
sqr-neg22.5%
sqrt-prod0.7%
add-sqr-sqrt1.4%
cbrt-div1.4%
add-sqr-sqrt0.7%
sqrt-unprod31.7%
sqr-neg31.7%
pow231.7%
sqrt-pow195.4%
metadata-eval95.4%
pow195.4%
Applied egg-rr95.4%
Final simplification95.4%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (cbrt (* (- g g) (/ -0.5 a)))))
(if (<= a -4.8e-86)
(+ t_0 (cbrt (* (/ 0.5 a) (* g -2.0))))
(if (<= a 7.2e-69)
(+ (cbrt -1.0) (/ (cbrt (- g)) (cbrt a)))
(- t_0 (cbrt (/ g a)))))))
double code(double g, double h, double a) {
double t_0 = cbrt(((g - g) * (-0.5 / a)));
double tmp;
if (a <= -4.8e-86) {
tmp = t_0 + cbrt(((0.5 / a) * (g * -2.0)));
} else if (a <= 7.2e-69) {
tmp = cbrt(-1.0) + (cbrt(-g) / cbrt(a));
} else {
tmp = t_0 - cbrt((g / a));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = Math.cbrt(((g - g) * (-0.5 / a)));
double tmp;
if (a <= -4.8e-86) {
tmp = t_0 + Math.cbrt(((0.5 / a) * (g * -2.0)));
} else if (a <= 7.2e-69) {
tmp = Math.cbrt(-1.0) + (Math.cbrt(-g) / Math.cbrt(a));
} else {
tmp = t_0 - Math.cbrt((g / a));
}
return tmp;
}
function code(g, h, a) t_0 = cbrt(Float64(Float64(g - g) * Float64(-0.5 / a))) tmp = 0.0 if (a <= -4.8e-86) tmp = Float64(t_0 + cbrt(Float64(Float64(0.5 / a) * Float64(g * -2.0)))); elseif (a <= 7.2e-69) tmp = Float64(cbrt(-1.0) + Float64(cbrt(Float64(-g)) / cbrt(a))); else tmp = Float64(t_0 - cbrt(Float64(g / a))); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[Power[N[(N[(g - g), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[a, -4.8e-86], N[(t$95$0 + N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(g * -2.0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 7.2e-69], N[(N[Power[-1.0, 1/3], $MachinePrecision] + N[(N[Power[(-g), 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\left(g - g\right) \cdot \frac{-0.5}{a}}\\
\mathbf{if}\;a \leq -4.8 \cdot 10^{-86}:\\
\;\;\;\;t\_0 + \sqrt[3]{\frac{0.5}{a} \cdot \left(g \cdot -2\right)}\\
\mathbf{elif}\;a \leq 7.2 \cdot 10^{-69}:\\
\;\;\;\;\sqrt[3]{-1} + \frac{\sqrt[3]{-g}}{\sqrt[3]{a}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 - \sqrt[3]{\frac{g}{a}}\\
\end{array}
\end{array}
if a < -4.80000000000000026e-86Initial program 58.9%
Simplified58.9%
Taylor expanded in g around -inf 37.1%
*-commutative37.1%
Simplified37.1%
Taylor expanded in g around -inf 94.3%
neg-mul-194.3%
Simplified94.3%
if -4.80000000000000026e-86 < a < 7.20000000000000035e-69Initial program 41.1%
Simplified41.1%
Taylor expanded in g around -inf 23.7%
*-commutative23.7%
Simplified23.7%
Taylor expanded in g around inf 11.6%
Applied egg-rr0.0%
Simplified45.8%
add-sqr-sqrt22.8%
sqrt-unprod10.3%
swap-sqr7.3%
count-27.3%
count-27.3%
swap-sqr7.3%
metadata-eval7.3%
metadata-eval7.3%
swap-sqr7.3%
*-commutative7.3%
*-commutative7.3%
frac-times7.3%
metadata-eval7.3%
metadata-eval7.3%
frac-times7.3%
swap-sqr10.3%
*-commutative10.3%
*-commutative10.3%
sqrt-unprod22.8%
add-sqr-sqrt45.8%
Applied egg-rr91.7%
Simplified91.7%
if 7.20000000000000035e-69 < a Initial program 51.2%
Simplified51.2%
Taylor expanded in g around -inf 26.3%
*-commutative26.3%
Simplified26.3%
Taylor expanded in g around -inf 87.5%
neg-mul-187.5%
Simplified87.5%
Taylor expanded in g around -inf 87.5%
mul-1-neg87.5%
Simplified87.5%
Final simplification90.9%
(FPCore (g h a) :precision binary64 (if (or (<= a -2.1e-16) (not (<= a 1.6e-42))) (+ (cbrt (* (/ 0.5 a) (* g -2.0))) (/ -1.0 (cbrt a))) (+ (cbrt (- g)) (cbrt (* (/ -0.5 a) (+ g g))))))
double code(double g, double h, double a) {
double tmp;
if ((a <= -2.1e-16) || !(a <= 1.6e-42)) {
tmp = cbrt(((0.5 / a) * (g * -2.0))) + (-1.0 / cbrt(a));
} else {
tmp = cbrt(-g) + cbrt(((-0.5 / a) * (g + g)));
}
return tmp;
}
public static double code(double g, double h, double a) {
double tmp;
if ((a <= -2.1e-16) || !(a <= 1.6e-42)) {
tmp = Math.cbrt(((0.5 / a) * (g * -2.0))) + (-1.0 / Math.cbrt(a));
} else {
tmp = Math.cbrt(-g) + Math.cbrt(((-0.5 / a) * (g + g)));
}
return tmp;
}
function code(g, h, a) tmp = 0.0 if ((a <= -2.1e-16) || !(a <= 1.6e-42)) tmp = Float64(cbrt(Float64(Float64(0.5 / a) * Float64(g * -2.0))) + Float64(-1.0 / cbrt(a))); else tmp = Float64(cbrt(Float64(-g)) + cbrt(Float64(Float64(-0.5 / a) * Float64(g + g)))); end return tmp end
code[g_, h_, a_] := If[Or[LessEqual[a, -2.1e-16], N[Not[LessEqual[a, 1.6e-42]], $MachinePrecision]], N[(N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(g * -2.0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[(-1.0 / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[(-g), 1/3], $MachinePrecision] + N[Power[N[(N[(-0.5 / a), $MachinePrecision] * N[(g + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.1 \cdot 10^{-16} \lor \neg \left(a \leq 1.6 \cdot 10^{-42}\right):\\
\;\;\;\;\sqrt[3]{\frac{0.5}{a} \cdot \left(g \cdot -2\right)} + \frac{-1}{\sqrt[3]{a}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{-g} + \sqrt[3]{\frac{-0.5}{a} \cdot \left(g + g\right)}\\
\end{array}
\end{array}
if a < -2.1000000000000001e-16 or 1.60000000000000012e-42 < a Initial program 52.3%
Simplified52.3%
Taylor expanded in g around -inf 30.9%
*-commutative30.9%
Simplified30.9%
Taylor expanded in g around inf 17.9%
Applied egg-rr0.0%
Simplified70.1%
if -2.1000000000000001e-16 < a < 1.60000000000000012e-42Initial program 45.7%
Simplified45.7%
Taylor expanded in g around -inf 24.7%
*-commutative24.7%
Simplified24.7%
Taylor expanded in g around inf 12.5%
Taylor expanded in a around 0 12.5%
Simplified54.5%
Final simplification63.2%
(FPCore (g h a)
:precision binary64
(let* ((t_0 (cbrt (* (/ -0.5 a) (+ g g)))))
(if (<= g -0.0021)
(+ (cbrt -1.0) t_0)
(if (<= g 6e-12) (+ (cbrt (- g)) t_0) (- (cbrt -1.0) (cbrt (/ g a)))))))
double code(double g, double h, double a) {
double t_0 = cbrt(((-0.5 / a) * (g + g)));
double tmp;
if (g <= -0.0021) {
tmp = cbrt(-1.0) + t_0;
} else if (g <= 6e-12) {
tmp = cbrt(-g) + t_0;
} else {
tmp = cbrt(-1.0) - cbrt((g / a));
}
return tmp;
}
public static double code(double g, double h, double a) {
double t_0 = Math.cbrt(((-0.5 / a) * (g + g)));
double tmp;
if (g <= -0.0021) {
tmp = Math.cbrt(-1.0) + t_0;
} else if (g <= 6e-12) {
tmp = Math.cbrt(-g) + t_0;
} else {
tmp = Math.cbrt(-1.0) - Math.cbrt((g / a));
}
return tmp;
}
function code(g, h, a) t_0 = cbrt(Float64(Float64(-0.5 / a) * Float64(g + g))) tmp = 0.0 if (g <= -0.0021) tmp = Float64(cbrt(-1.0) + t_0); elseif (g <= 6e-12) tmp = Float64(cbrt(Float64(-g)) + t_0); else tmp = Float64(cbrt(-1.0) - cbrt(Float64(g / a))); end return tmp end
code[g_, h_, a_] := Block[{t$95$0 = N[Power[N[(N[(-0.5 / a), $MachinePrecision] * N[(g + g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[g, -0.0021], N[(N[Power[-1.0, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[g, 6e-12], N[(N[Power[(-g), 1/3], $MachinePrecision] + t$95$0), $MachinePrecision], N[(N[Power[-1.0, 1/3], $MachinePrecision] - N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\frac{-0.5}{a} \cdot \left(g + g\right)}\\
\mathbf{if}\;g \leq -0.0021:\\
\;\;\;\;\sqrt[3]{-1} + t\_0\\
\mathbf{elif}\;g \leq 6 \cdot 10^{-12}:\\
\;\;\;\;\sqrt[3]{-g} + t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{-1} - \sqrt[3]{\frac{g}{a}}\\
\end{array}
\end{array}
if g < -0.00209999999999999987Initial program 39.0%
Simplified39.0%
Taylor expanded in g around -inf 39.2%
*-commutative39.2%
Simplified39.2%
Taylor expanded in g around inf 15.0%
Applied egg-rr0.0%
Simplified41.9%
if -0.00209999999999999987 < g < 6.0000000000000003e-12Initial program 71.2%
Simplified71.2%
Taylor expanded in g around -inf 43.3%
*-commutative43.3%
Simplified43.3%
Taylor expanded in g around inf 16.9%
Taylor expanded in a around 0 16.9%
Simplified50.1%
if 6.0000000000000003e-12 < g Initial program 43.1%
Simplified43.1%
Taylor expanded in g around -inf 10.2%
*-commutative10.2%
Simplified10.2%
Taylor expanded in g around inf 15.0%
Applied egg-rr0.0%
Simplified45.6%
Taylor expanded in g around 0 45.6%
Simplified45.6%
Final simplification45.6%
(FPCore (g h a) :precision binary64 (+ (cbrt (* (- g g) (/ -0.5 a))) (cbrt (* (/ 0.5 a) (* g -2.0)))))
double code(double g, double h, double a) {
return cbrt(((g - g) * (-0.5 / a))) + cbrt(((0.5 / a) * (g * -2.0)));
}
public static double code(double g, double h, double a) {
return Math.cbrt(((g - g) * (-0.5 / a))) + Math.cbrt(((0.5 / a) * (g * -2.0)));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(g - g) * Float64(-0.5 / a))) + cbrt(Float64(Float64(0.5 / a) * Float64(g * -2.0)))) end
code[g_, h_, a_] := N[(N[Power[N[(N[(g - g), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(0.5 / a), $MachinePrecision] * N[(g * -2.0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\left(g - g\right) \cdot \frac{-0.5}{a}} + \sqrt[3]{\frac{0.5}{a} \cdot \left(g \cdot -2\right)}
\end{array}
Initial program 49.4%
Simplified49.4%
Taylor expanded in g around -inf 28.2%
*-commutative28.2%
Simplified28.2%
Taylor expanded in g around -inf 74.7%
neg-mul-174.7%
Simplified74.7%
Final simplification74.7%
(FPCore (g h a) :precision binary64 (- (cbrt (* (- g g) (/ -0.5 a))) (cbrt (/ g a))))
double code(double g, double h, double a) {
return cbrt(((g - g) * (-0.5 / a))) - cbrt((g / a));
}
public static double code(double g, double h, double a) {
return Math.cbrt(((g - g) * (-0.5 / a))) - Math.cbrt((g / a));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(g - g) * Float64(-0.5 / a))) - cbrt(Float64(g / a))) end
code[g_, h_, a_] := N[(N[Power[N[(N[(g - g), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{\left(g - g\right) \cdot \frac{-0.5}{a}} - \sqrt[3]{\frac{g}{a}}
\end{array}
Initial program 49.4%
Simplified49.4%
Taylor expanded in g around -inf 28.2%
*-commutative28.2%
Simplified28.2%
Taylor expanded in g around -inf 74.7%
neg-mul-174.7%
Simplified74.7%
Taylor expanded in g around -inf 74.7%
mul-1-neg74.7%
Simplified74.7%
Final simplification74.7%
(FPCore (g h a) :precision binary64 (- (cbrt -1.0) (cbrt (/ g a))))
double code(double g, double h, double a) {
return cbrt(-1.0) - cbrt((g / a));
}
public static double code(double g, double h, double a) {
return Math.cbrt(-1.0) - Math.cbrt((g / a));
}
function code(g, h, a) return Float64(cbrt(-1.0) - cbrt(Float64(g / a))) end
code[g_, h_, a_] := N[(N[Power[-1.0, 1/3], $MachinePrecision] - N[Power[N[(g / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{-1} - \sqrt[3]{\frac{g}{a}}
\end{array}
Initial program 49.4%
Simplified49.4%
Taylor expanded in g around -inf 28.2%
*-commutative28.2%
Simplified28.2%
Taylor expanded in g around inf 15.5%
Applied egg-rr0.0%
Simplified42.4%
Taylor expanded in g around 0 42.4%
Simplified42.4%
Final simplification42.4%
(FPCore (g h a) :precision binary64 (+ (cbrt -1.0) (/ -1.0 (cbrt a))))
double code(double g, double h, double a) {
return cbrt(-1.0) + (-1.0 / cbrt(a));
}
public static double code(double g, double h, double a) {
return Math.cbrt(-1.0) + (-1.0 / Math.cbrt(a));
}
function code(g, h, a) return Float64(cbrt(-1.0) + Float64(-1.0 / cbrt(a))) end
code[g_, h_, a_] := N[(N[Power[-1.0, 1/3], $MachinePrecision] + N[(-1.0 / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{-1} + \frac{-1}{\sqrt[3]{a}}
\end{array}
Initial program 49.4%
Simplified49.4%
Taylor expanded in g around -inf 28.2%
*-commutative28.2%
Simplified28.2%
Taylor expanded in g around inf 15.5%
Applied egg-rr0.0%
Simplified42.4%
Applied egg-rr0.0%
Simplified5.2%
(FPCore (g h a) :precision binary64 -1.0)
double code(double g, double h, double a) {
return -1.0;
}
real(8) function code(g, h, a)
real(8), intent (in) :: g
real(8), intent (in) :: h
real(8), intent (in) :: a
code = -1.0d0
end function
public static double code(double g, double h, double a) {
return -1.0;
}
def code(g, h, a): return -1.0
function code(g, h, a) return -1.0 end
function tmp = code(g, h, a) tmp = -1.0; end
code[g_, h_, a_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 49.4%
Simplified49.4%
Taylor expanded in g around -inf 28.2%
*-commutative28.2%
Simplified28.2%
Taylor expanded in g around inf 15.5%
Applied egg-rr0.0%
Simplified42.4%
Applied egg-rr4.6%
herbie shell --seed 2024088
(FPCore (g h a)
:name "2-ancestry mixing, positive discriminant"
:precision binary64
(+ (cbrt (* (/ 1.0 (* 2.0 a)) (+ (- g) (sqrt (- (* g g) (* h h)))))) (cbrt (* (/ 1.0 (* 2.0 a)) (- (- g) (sqrt (- (* g g) (* h h))))))))