\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)}\log \left(1 + \mathsf{expm1}\left(\frac{1}{\cos \left(\frac{x}{y \cdot 2}\right)}\right)\right)double f(double x, double y) {
double r412621 = x;
double r412622 = y;
double r412623 = 2.0;
double r412624 = r412622 * r412623;
double r412625 = r412621 / r412624;
double r412626 = tan(r412625);
double r412627 = sin(r412625);
double r412628 = r412626 / r412627;
return r412628;
}
double f(double x, double y) {
double r412629 = 1.0;
double r412630 = x;
double r412631 = y;
double r412632 = 2.0;
double r412633 = r412631 * r412632;
double r412634 = r412630 / r412633;
double r412635 = cos(r412634);
double r412636 = r412629 / r412635;
double r412637 = expm1(r412636);
double r412638 = r412629 + r412637;
double r412639 = log(r412638);
return r412639;
}




Bits error versus x




Bits error versus y
Results
| Original | 36.1 |
|---|---|
| Target | 29.3 |
| Herbie | 28.9 |
Initial program 36.1
rmApplied tan-quot36.1
Applied associate-/l/36.1
rmApplied log1p-expm1-u36.1
Simplified28.9
rmApplied log1p-udef28.9
Final simplification28.9
herbie shell --seed 2019303 +o rules:numerics
(FPCore (x y)
:name "Diagrams.TwoD.Layout.CirclePacking:approxRadius from diagrams-contrib-1.3.0.5"
:precision binary64
:herbie-target
(if (< y -1.23036909113069936e114) 1 (if (< y -9.1028524068119138e-222) (/ (sin (/ x (* y 2))) (* (sin (/ x (* y 2))) (log (exp (cos (/ x (* y 2))))))) 1))
(/ (tan (/ x (* y 2))) (sin (/ x (* y 2)))))