double f(double a1, double a2, double th) {
double r5312401 = th;
double r5312402 = cos(r5312401);
double r5312403 = 2.0;
double r5312404 = sqrt(r5312403);
double r5312405 = r5312402 / r5312404;
double r5312406 = a1;
double r5312407 = r5312406 * r5312406;
double r5312408 = r5312405 * r5312407;
double r5312409 = a2;
double r5312410 = r5312409 * r5312409;
double r5312411 = r5312405 * r5312410;
double r5312412 = r5312408 + r5312411;
return r5312412;
}
double f(double a1, double a2, double th) {
double r5312413 = a2;
double r5312414 = th;
double r5312415 = cos(r5312414);
double r5312416 = r5312413 * r5312415;
double r5312417 = r5312416 * r5312413;
double r5312418 = 2.0;
double r5312419 = sqrt(r5312418);
double r5312420 = r5312417 / r5312419;
double r5312421 = a1;
double r5312422 = r5312421 * r5312415;
double r5312423 = r5312422 / r5312419;
double r5312424 = r5312423 * r5312421;
double r5312425 = r5312420 + r5312424;
return r5312425;
}
\frac{\cos th}{\sqrt{2}} \cdot \left(a1 \cdot a1\right) + \frac{\cos th}{\sqrt{2}} \cdot \left(a2 \cdot a2\right)\frac{\left(a2 \cdot \cos th\right) \cdot a2}{\sqrt{2}} + \frac{a1 \cdot \cos th}{\sqrt{2}} \cdot a1


Bits error versus a1



Bits error versus a2



Bits error versus th
Initial program 0.5
rmApplied associate-*r*0.5
Taylor expanded around -inf 0.5
Simplified0.5
rmApplied associate-*l/0.4
Applied associate-*l/0.5
rmApplied associate-/r/0.4
Final simplification0.4
herbie shell --seed 2019102 +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))))