\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}
t_0 := g + \sqrt{g \cdot g - h \cdot h}\\
\mathbf{if}\;g \leq 7.090974630018953 \cdot 10^{-201}:\\
\;\;\;\;\sqrt[3]{\left(0.5 \cdot \frac{h \cdot h}{g} - g\right) - g} \cdot \sqrt[3]{\frac{0.5}{a}} + \sqrt[3]{\frac{t_0}{a} \cdot -0.5}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{-0.5 \cdot \frac{{h}^{2}}{g}}{a \cdot 2}} + \frac{\sqrt[3]{t_0 \cdot -0.5}}{\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
(let* ((t_0 (+ g (sqrt (- (* g g) (* h h))))))
(if (<= g 7.090974630018953e-201)
(+
(* (cbrt (- (- (* 0.5 (/ (* h h) g)) g) g)) (cbrt (/ 0.5 a)))
(cbrt (* (/ t_0 a) -0.5)))
(+
(cbrt (/ (* -0.5 (/ (pow h 2.0) g)) (* a 2.0)))
(/ (cbrt (* t_0 -0.5)) (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 t_0 = g + sqrt((g * g) - (h * h));
double tmp;
if (g <= 7.090974630018953e-201) {
tmp = (cbrt(((0.5 * ((h * h) / g)) - g) - g) * cbrt(0.5 / a)) + cbrt((t_0 / a) * -0.5);
} else {
tmp = cbrt((-0.5 * (pow(h, 2.0) / g)) / (a * 2.0)) + (cbrt(t_0 * -0.5) / cbrt(a));
}
return tmp;
}



Bits error versus g



Bits error versus h



Bits error versus a
Results
if g < 7.0909746300189531e-201Initial program 36.8
Simplified36.8
Applied div-inv_binary6436.8
Applied cbrt-prod_binary6432.8
Simplified32.8
Taylor expanded in g around -inf 31.6
Simplified31.6
if 7.0909746300189531e-201 < g Initial program 36.2
Simplified36.1
Applied associate-*l/_binary6436.1
Applied cbrt-div_binary6432.1
Taylor expanded in g around inf 31.7
Final simplification31.7
herbie shell --seed 2021280
(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))))))))