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}}}{\sqrt{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)) (sqrt 3.0)) (sqrt 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) / sqrt(3.0)) / sqrt(3.0)) * -2.0;
}








Bits error versus g








Bits error versus h
Results
| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 26112 |
| Alternative 2 | |
|---|---|
| Error | 1.0 |
| Cost | 13248 |
| Alternative 3 | |
|---|---|
| Error | 51.5 |
| Cost | 64 |
| Alternative 4 | |
|---|---|
| Error | 62.0 |
| Cost | 64 |
| Alternative 5 | |
|---|---|
| Error | 63.0 |
| Cost | 64 |

Initial program 1.0
Simplified1.0
rmApplied distribute-frac-neg_binary64_14051.0
Applied acos-neg_binary64_16251.0
Applied div-sub_binary64_14471.0
Applied associate-+r-_binary64_13761.0
Applied cos-diff_binary64_15790.0
Simplified0.0
Simplified1.0
rmApplied add-sqr-sqrt_binary64_14640.0
Applied associate-/r*_binary64_13860.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2021044
(FPCore (g h)
:name "2-ancestry mixing, negative discriminant"
:precision binary64
(* 2.0 (cos (+ (/ (* 2.0 PI) 3.0) (/ (acos (/ (- g) h)) 3.0)))))