\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)a2 \cdot \frac{a2 \cdot \cos th}{\sqrt{2}} + \frac{a1 \cdot \cos th}{\frac{\sqrt{2}}{a1}}double f(double a1, double a2, double th) {
double r16404811 = th;
double r16404812 = cos(r16404811);
double r16404813 = 2.0;
double r16404814 = sqrt(r16404813);
double r16404815 = r16404812 / r16404814;
double r16404816 = a1;
double r16404817 = r16404816 * r16404816;
double r16404818 = r16404815 * r16404817;
double r16404819 = a2;
double r16404820 = r16404819 * r16404819;
double r16404821 = r16404815 * r16404820;
double r16404822 = r16404818 + r16404821;
return r16404822;
}
double f(double a1, double a2, double th) {
double r16404823 = a2;
double r16404824 = th;
double r16404825 = cos(r16404824);
double r16404826 = r16404823 * r16404825;
double r16404827 = 2.0;
double r16404828 = sqrt(r16404827);
double r16404829 = r16404826 / r16404828;
double r16404830 = r16404823 * r16404829;
double r16404831 = a1;
double r16404832 = r16404831 * r16404825;
double r16404833 = r16404828 / r16404831;
double r16404834 = r16404832 / r16404833;
double r16404835 = r16404830 + r16404834;
return r16404835;
}



Bits error versus a1



Bits error versus a2



Bits error versus th
Results
Initial program 0.5
rmApplied add-sqr-sqrt0.5
Applied sqrt-prod0.5
Applied associate-/r*0.5
Taylor expanded around inf 0.5
Simplified0.5
rmApplied add-sqr-sqrt0.5
Applied sqrt-prod0.5
Applied sqrt-prod0.5
Applied div-inv0.5
Applied times-frac0.4
Taylor expanded around inf 0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2019112 +o rules:numerics
(FPCore (a1 a2 th)
:name "Migdal et al, Equation (64)"
(+ (* (/ (cos th) (sqrt 2)) (* a1 a1)) (* (/ (cos th) (sqrt 2)) (* a2 a2))))