\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\left(\cos th \cdot \mathsf{hypot}\left(a1, a2\right)\right) \cdot \sqrt{\frac{\mathsf{fma}\left(a1, a1, a2 \cdot a2\right)}{2}}double f(double a1, double a2, double th) {
double r1809050 = th;
double r1809051 = cos(r1809050);
double r1809052 = 2.0;
double r1809053 = sqrt(r1809052);
double r1809054 = r1809051 / r1809053;
double r1809055 = a1;
double r1809056 = r1809055 * r1809055;
double r1809057 = r1809054 * r1809056;
double r1809058 = a2;
double r1809059 = r1809058 * r1809058;
double r1809060 = r1809054 * r1809059;
double r1809061 = r1809057 + r1809060;
return r1809061;
}
double f(double a1, double a2, double th) {
double r1809062 = th;
double r1809063 = cos(r1809062);
double r1809064 = a1;
double r1809065 = a2;
double r1809066 = hypot(r1809064, r1809065);
double r1809067 = r1809063 * r1809066;
double r1809068 = r1809065 * r1809065;
double r1809069 = fma(r1809064, r1809064, r1809068);
double r1809070 = 2.0;
double r1809071 = r1809069 / r1809070;
double r1809072 = sqrt(r1809071);
double r1809073 = r1809067 * r1809072;
return r1809073;
}



Bits error versus a1



Bits error versus a2



Bits error versus th
Initial program 0.5
Simplified0.5
rmApplied *-un-lft-identity0.5
Applied sqrt-prod0.5
Applied add-sqr-sqrt0.5
Applied times-frac0.5
Simplified0.5
Simplified0.5
rmApplied associate-*r*0.5
rmApplied hypot-udef0.5
Applied sqrt-undiv0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2019174 +o rules:numerics
(FPCore (a1 a2 th)
:name "Migdal et al, Equation (64)"
(+ (* (/ (cos th) (sqrt 2.0)) (* a1 a1)) (* (/ (cos th) (sqrt 2.0)) (* a2 a2))))