2 \cdot \cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)2 \cdot \left(\cos \left(0.6666666666666666 \cdot \pi\right) \cdot \cos \left(0.3333333333333333 \cdot \cos^{-1} \left(-\frac{g}{h}\right)\right) - \sin \left(\sqrt{\pi} \cdot \left(0.6666666666666666 \cdot \sqrt{\pi}\right)\right) \cdot \sin \left(\frac{\cos^{-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
(-
(*
(cos (* 0.6666666666666666 PI))
(cos (* 0.3333333333333333 (acos (- (/ g h))))))
(*
(sin (* (sqrt PI) (* 0.6666666666666666 (sqrt PI))))
(sin (/ (acos (- (/ g h))) 3.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 2.0 * ((cos(0.6666666666666666 * ((double) M_PI)) * cos(0.3333333333333333 * acos(-(g / h)))) - (sin(sqrt((double) M_PI) * (0.6666666666666666 * sqrt((double) M_PI))) * sin(acos(-(g / h)) / 3.0)));
}



Bits error versus g



Bits error versus h
Results
Initial program 1.0
Simplified1.0
rmApplied cos-sum_binary64_32811.0
Simplified1.0
rmApplied add-sqr-sqrt_binary64_31690.0
Applied associate-*r*_binary64_30870.0
Final simplification0.0
herbie shell --seed 2021032
(FPCore (g h)
:name "2-ancestry mixing, negative discriminant"
:precision binary64
(* 2.0 (cos (+ (/ (* 2.0 PI) 3.0) (/ (acos (/ (- g) h)) 3.0)))))