\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(\mathsf{neg}\left(g\right)\right) - \sqrt{g \cdot g - h \cdot h}\right)}\begin{array}{l}
\mathbf{if}\;\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\sqrt{g \cdot g - h \cdot h} - g\right)} + \sqrt[3]{\left(g + \sqrt{g \cdot g - h \cdot h}\right) \cdot \frac{-1}{2 \cdot a}} \leq \infty:\\
\;\;\;\;\sqrt[3]{\sqrt{g \cdot g - h \cdot h} - g} \cdot \sqrt[3]{\frac{0.5}{a}} + \frac{\sqrt[3]{-0.5 \cdot \left(g + \sqrt{g \cdot g - h \cdot h}\right)}}{\sqrt[3]{a}}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}(FPCore (g h a) :precision binary64 (+ (cbrt (* (/ 1.0 (* 2.0 a)) (+ (neg g) (sqrt (- (* g g) (* h h)))))) (cbrt (* (/ 1.0 (* 2.0 a)) (- (neg g) (sqrt (- (* g g) (* h h))))))))
(FPCore (g h a)
:precision binary64
(if (<=
(+
(cbrt (* (/ 1.0 (* 2.0 a)) (- (sqrt (- (* g g) (* h h))) g)))
(cbrt (* (+ g (sqrt (- (* g g) (* h h)))) (/ -1.0 (* 2.0 a)))))
INFINITY)
(+
(* (cbrt (- (sqrt (- (* g g) (* h h))) g)) (cbrt (/ 0.5 a)))
(/ (cbrt (* -0.5 (+ g (sqrt (- (* g g) (* h h)))))) (cbrt a)))
1.0))


Bits error versus g



Bits error versus h



Bits error versus a
if (+.f64 (cbrt.f64 (*.f64 (/.f64 1 (*.f64 2 a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 1 (*.f64 2 a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) < +inf.0Initial program 13.5
Simplified13.5
rmApplied div-inv_binary6413.5
Applied cbrt-prod_binary6410.1
Simplified10.1
rmApplied associate-*l/_binary6410.1
Applied cbrt-div_binary647.1
Simplified7.1
rmApplied *-un-lft-identity_binary647.1
Applied sqrt-prod_binary647.1
if +inf.0 < (+.f64 (cbrt.f64 (*.f64 (/.f64 1 (*.f64 2 a)) (+.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h)))))) (cbrt.f64 (*.f64 (/.f64 1 (*.f64 2 a)) (-.f64 (neg.f64 g) (sqrt.f64 (-.f64 (*.f64 g g) (*.f64 h h))))))) Initial program 61.3
Final simplification30.5
herbie shell --seed 2021125
(FPCore (g h a)
:name "2-ancestry mixing, positive discriminant"
:precision binary64
(+ (cbrt (* (/ 1.0 (* 2.0 a)) (+ (neg g) (sqrt (- (* g g) (* h h)))))) (cbrt (* (/ 1.0 (* 2.0 a)) (- (neg g) (sqrt (- (* g g) (* h h))))))))