2 \cdot \cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)2 \cdot \left(\left(-\frac{\sqrt{3}}{2}\right) \cdot \cos \left(\frac{\sin^{-1} \left(\frac{g}{h}\right)}{3}\right) - 0.5 \cdot \sin \left(\frac{\sin^{-1} \left(\frac{g}{h}\right)}{3}\right)\right)(FPCore (g h) :precision binary64 (* 2.0 (cos (+ (/ (* 2.0 PI) 3.0) (/ (acos (/ (- g) h)) 3.0)))))
(FPCore (g h) :precision binary64 (* 2.0 (- (* (- (/ (sqrt 3.0) 2.0)) (cos (/ (asin (/ g h)) 3.0))) (* 0.5 (sin (/ (asin (/ g h)) 3.0))))))
double code(double g, double h) {
return ((double) (2.0 * ((double) cos(((double) ((((double) (2.0 * ((double) M_PI))) / 3.0) + (((double) acos((((double) -(g)) / h))) / 3.0)))))));
}
double code(double g, double h) {
return ((double) (2.0 * ((double) (((double) (((double) -((((double) sqrt(3.0)) / 2.0))) * ((double) cos((((double) asin((g / h))) / 3.0))))) - ((double) (0.5 * ((double) sin((((double) asin((g / h))) / 3.0)))))))));
}



Bits error versus g



Bits error versus h
Results
Initial program 1.0
Simplified1.0
rmApplied distribute-frac-neg_binary641.0
Applied acos-neg_binary641.0
Applied div-sub_binary641.0
Applied associate-+r-_binary641.0
Simplified1.0
rmApplied acos-asin_binary641.0
Applied div-sub_binary641.0
Applied associate--r-_binary641.0
Applied cos-sum_binary641.0
Simplified0.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2020210
(FPCore (g h)
:name "2-ancestry mixing, negative discriminant"
:precision binary64
(* 2.0 (cos (+ (/ (* 2.0 PI) 3.0) (/ (acos (/ (- g) h)) 3.0)))))