2 \cdot \cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)\cos \left(\frac{\frac{\cos^{-1} \left(\frac{g}{h}\right)}{\sqrt[3]{3} \cdot \sqrt[3]{3}}}{\sqrt[3]{3}}\right) \cdot -2(FPCore (g h) :precision binary64 (* 2.0 (cos (+ (/ (* 2.0 PI) 3.0) (/ (acos (/ (- g) h)) 3.0)))))
(FPCore (g h) :precision binary64 (* (cos (/ (/ (acos (/ g h)) (* (cbrt 3.0) (cbrt 3.0))) (cbrt 3.0))) -2.0))
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 cos((acos(g / h) / (cbrt(3.0) * cbrt(3.0))) / cbrt(3.0)) * -2.0;
}



Bits error versus g



Bits error versus h
Results
Initial program 1.0
Simplified1.0
rmApplied distribute-frac-neg_binary64_31101.0
Applied acos-neg_binary64_33301.0
Applied div-sub_binary64_31521.0
Applied associate-+r-_binary64_30811.0
Applied cos-diff_binary64_32840.1
Simplified0.1
Simplified0.9
rmApplied add-cube-cbrt_binary64_31820.9
Applied associate-/r*_binary64_30910.0
Final simplification0.0
herbie shell --seed 2021077
(FPCore (g h)
:name "2-ancestry mixing, negative discriminant"
:precision binary64
(* 2.0 (cos (+ (/ (* 2.0 PI) 3.0) (/ (acos (/ (- g) h)) 3.0)))))