\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 -1.590876763403097 \cdot 10^{-162}:\\
\;\;\;\;\sqrt[3]{\frac{1}{2 \cdot a}} \cdot \sqrt[3]{\sqrt{g \cdot g - h \cdot h} - g} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(h \cdot h\right)}}{\sqrt[3]{\left(-g\right) - \sqrt{g \cdot g - h \cdot h}}} + \sqrt[3]{\frac{1}{2 \cdot a}} \cdot \sqrt[3]{\left(-g\right) - \sqrt{g \cdot g - h \cdot h}}\\
\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 -1.590876763403097e-162)
(+
(* (cbrt (/ 1.0 (* 2.0 a))) (cbrt (- (sqrt (- (* g g) (* h h))) g)))
(cbrt (* (/ 1.0 (* 2.0 a)) (- (- g) (sqrt (- (* g g) (* h h)))))))
(+
(/
(cbrt (* (/ 1.0 (* 2.0 a)) (* h h)))
(cbrt (- (- g) (sqrt (- (* g g) (* h h))))))
(* (cbrt (/ 1.0 (* 2.0 a))) (cbrt (- (- g) (sqrt (- (* g g) (* h h)))))))))double code(double g, double h, double a) {
return ((double) (((double) cbrt(((double) ((1.0 / ((double) (2.0 * a))) * ((double) (((double) -(g)) + ((double) sqrt(((double) (((double) (g * g)) - ((double) (h * h)))))))))))) + ((double) cbrt(((double) ((1.0 / ((double) (2.0 * a))) * ((double) (((double) -(g)) - ((double) sqrt(((double) (((double) (g * g)) - ((double) (h * h))))))))))))));
}
double code(double g, double h, double a) {
double tmp;
if ((g <= -1.590876763403097e-162)) {
tmp = ((double) (((double) (((double) cbrt((1.0 / ((double) (2.0 * a))))) * ((double) cbrt(((double) (((double) sqrt(((double) (((double) (g * g)) - ((double) (h * h)))))) - g)))))) + ((double) cbrt(((double) ((1.0 / ((double) (2.0 * a))) * ((double) (((double) -(g)) - ((double) sqrt(((double) (((double) (g * g)) - ((double) (h * h))))))))))))));
} else {
tmp = ((double) ((((double) cbrt(((double) ((1.0 / ((double) (2.0 * a))) * ((double) (h * h)))))) / ((double) cbrt(((double) (((double) -(g)) - ((double) sqrt(((double) (((double) (g * g)) - ((double) (h * h))))))))))) + ((double) (((double) cbrt((1.0 / ((double) (2.0 * a))))) * ((double) cbrt(((double) (((double) -(g)) - ((double) sqrt(((double) (((double) (g * g)) - ((double) (h * h))))))))))))));
}
return tmp;
}



Bits error versus g



Bits error versus h



Bits error versus a
Results
if g < -1.59087676340309706e-162Initial program Error: 34.9 bits
rmApplied cbrt-prodError: 30.8 bits
SimplifiedError: 30.8 bits
if -1.59087676340309706e-162 < g Initial program Error: 36.2 bits
rmApplied cbrt-prodError: 33.0 bits
rmApplied flip-+Error: 32.9 bits
Applied associate-*r/Error: 32.9 bits
Applied cbrt-divError: 32.9 bits
SimplifiedError: 32.9 bits
Final simplificationError: 31.9 bits
herbie shell --seed 2020203
(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))))))))