2 \cdot \cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)2 \cdot \sqrt[3]{{\left(\sqrt[3]{\cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right) \cdot \cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)} \cdot \sqrt[3]{\cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)}\right)}^{3}}double code(double g, double h) {
return (2.0 * cos((((2.0 * ((double) M_PI)) / 3.0) + (acos((-g / h)) / 3.0))));
}
double code(double g, double h) {
return (2.0 * cbrt(pow((cbrt((cos((((2.0 * ((double) M_PI)) / 3.0) + (acos((-g / h)) / 3.0))) * cos((((2.0 * ((double) M_PI)) / 3.0) + (acos((-g / h)) / 3.0))))) * cbrt(cos((((2.0 * ((double) M_PI)) / 3.0) + (acos((-g / h)) / 3.0))))), 3.0)));
}



Bits error versus g



Bits error versus h
Results
Initial program 1.0
rmApplied add-cbrt-cube1.6
Simplified1.0
rmApplied add-cube-cbrt1.0
Simplified0.1
Final simplification0.1
herbie shell --seed 2020092
(FPCore (g h)
:name "2-ancestry mixing, negative discriminant"
:precision binary64
(* 2 (cos (+ (/ (* 2 PI) 3) (/ (acos (/ (- g) h)) 3)))))