\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)}\begin{array}{l}
\mathbf{if}\;g \leq 4.4760633336146326 \cdot 10^{-179}:\\
\;\;\;\;\sqrt[3]{\left|\sqrt[3]{g \cdot g - h \cdot h}\right| \cdot \sqrt{\sqrt[3]{g \cdot g - h \cdot h}} - g} \cdot \sqrt[3]{\frac{0.5}{a}} + \sqrt[3]{\frac{g + \sqrt{g \cdot g - h \cdot h}}{a} \cdot -0.5}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{0.5}{a}} \cdot \sqrt[3]{\sqrt{g \cdot g - h \cdot h} - g} + \frac{\sqrt[3]{-0.5 \cdot \left(g + \sqrt[3]{\sqrt{g \cdot g - h \cdot h}} \cdot \left(\sqrt[3]{\sqrt{g \cdot g - h \cdot h}} \cdot \sqrt[3]{\sqrt{g \cdot g - h \cdot h}}\right)\right)}}{\sqrt[3]{a}}\\
\end{array}(FPCore (g h a) :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))))))))
(FPCore (g h a)
:precision binary64
(if (<= g 4.4760633336146326e-179)
(+
(*
(cbrt
(-
(* (fabs (cbrt (- (* g g) (* h h)))) (sqrt (cbrt (- (* g g) (* h h)))))
g))
(cbrt (/ 0.5 a)))
(cbrt (* (/ (+ g (sqrt (- (* g g) (* h h)))) a) -0.5)))
(+
(* (cbrt (/ 0.5 a)) (cbrt (- (sqrt (- (* g g) (* h h))) g)))
(/
(cbrt
(*
-0.5
(+
g
(*
(cbrt (sqrt (- (* g g) (* h h))))
(*
(cbrt (sqrt (- (* g g) (* h h))))
(cbrt (sqrt (- (* g g) (* h h)))))))))
(cbrt a)))))double code(double g, double h, double a) {
return cbrt((1.0 / (2.0 * a)) * (-g + sqrt((g * g) - (h * h)))) + cbrt((1.0 / (2.0 * a)) * (-g - sqrt((g * g) - (h * h))));
}
double code(double g, double h, double a) {
double tmp;
if (g <= 4.4760633336146326e-179) {
tmp = (cbrt((fabs(cbrt((g * g) - (h * h))) * sqrt(cbrt((g * g) - (h * h)))) - g) * cbrt(0.5 / a)) + cbrt(((g + sqrt((g * g) - (h * h))) / a) * -0.5);
} else {
tmp = (cbrt(0.5 / a) * cbrt(sqrt((g * g) - (h * h)) - g)) + (cbrt(-0.5 * (g + (cbrt(sqrt((g * g) - (h * h))) * (cbrt(sqrt((g * g) - (h * h))) * cbrt(sqrt((g * g) - (h * h))))))) / cbrt(a));
}
return tmp;
}



Bits error versus g



Bits error versus h



Bits error versus a
Results
if g < 4.4760633336146326e-179Initial program 37.0
Simplified37.0
rmApplied div-inv_binary6437.0
Applied cbrt-prod_binary6432.9
Simplified32.8
rmApplied add-cube-cbrt_binary6432.8
Applied sqrt-prod_binary6432.8
Simplified32.8
if 4.4760633336146326e-179 < g Initial program 34.2
Simplified34.2
rmApplied div-inv_binary6434.2
Applied cbrt-prod_binary6434.1
Simplified34.1
rmApplied associate-*l/_binary6434.1
Applied cbrt-div_binary6430.4
rmApplied add-cube-cbrt_binary6430.4
Final simplification31.7
herbie shell --seed 2020268
(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))))))))