\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 := \sqrt{g \cdot g - h \cdot h}\\
t_1 := \sqrt[3]{2 \cdot a}\\
\frac{\sqrt[3]{t_0 - g}}{t_1} + \frac{\sqrt[3]{\left(-g\right) - t_0}}{t_1}
\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 (sqrt (- (* g g) (* h h)))) (t_1 (cbrt (* 2.0 a)))) (+ (/ (cbrt (- t_0 g)) t_1) (/ (cbrt (- (- g) t_0)) t_1))))
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 = sqrt((g * g) - (h * h));
double t_1 = cbrt(2.0 * a);
return (cbrt(t_0 - g) / t_1) + (cbrt(-g - t_0) / t_1);
}



Bits error versus g



Bits error versus h



Bits error versus a
Results
Initial program 35.2
Applied associate-*l/_binary6435.2
Applied cbrt-div_binary6433.5
Simplified33.5
Applied associate-*l/_binary6433.5
Applied cbrt-div_binary6431.8
Simplified31.8
Applied sub-neg_binary6431.8
Final simplification31.8
herbie shell --seed 2021332
(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))))))))