\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\mathsf{fma}\left(\frac{a1}{\sqrt[3]{\sqrt{2}} \cdot \sqrt[3]{\sqrt{2}}} \cdot \frac{a1}{\sqrt[3]{\sqrt{2}}}, \cos th, \left(a2 \cdot \cos th\right) \cdot \frac{{a2}^{1}}{\sqrt{2}}\right)double f(double a1, double a2, double th) {
double r91000 = th;
double r91001 = cos(r91000);
double r91002 = 2.0;
double r91003 = sqrt(r91002);
double r91004 = r91001 / r91003;
double r91005 = a1;
double r91006 = r91005 * r91005;
double r91007 = r91004 * r91006;
double r91008 = a2;
double r91009 = r91008 * r91008;
double r91010 = r91004 * r91009;
double r91011 = r91007 + r91010;
return r91011;
}
double f(double a1, double a2, double th) {
double r91012 = a1;
double r91013 = 2.0;
double r91014 = sqrt(r91013);
double r91015 = cbrt(r91014);
double r91016 = r91015 * r91015;
double r91017 = r91012 / r91016;
double r91018 = r91012 / r91015;
double r91019 = r91017 * r91018;
double r91020 = th;
double r91021 = cos(r91020);
double r91022 = a2;
double r91023 = r91022 * r91021;
double r91024 = 1.0;
double r91025 = pow(r91022, r91024);
double r91026 = r91025 / r91014;
double r91027 = r91023 * r91026;
double r91028 = fma(r91019, r91021, r91027);
return r91028;
}



Bits error versus a1



Bits error versus a2



Bits error versus th
Initial program 0.5
Simplified0.5
Taylor expanded around inf 0.5
Simplified0.5
rmApplied sqr-pow0.5
Applied associate-*r*0.5
Simplified0.5
rmApplied *-un-lft-identity0.5
Applied sqrt-prod0.5
Applied times-frac0.5
Simplified0.5
Simplified0.5
rmApplied add-cube-cbrt0.5
Applied add-sqr-sqrt32.5
Applied unpow-prod-down32.5
Applied times-frac32.5
Simplified32.5
Simplified0.5
Final simplification0.5
herbie shell --seed 2020034 +o rules:numerics
(FPCore (a1 a2 th)
:name "Migdal et al, Equation (64)"
:precision binary64
(+ (* (/ (cos th) (sqrt 2)) (* a1 a1)) (* (/ (cos th) (sqrt 2)) (* a2 a2))))