\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)}\begin{array}{l}
\mathbf{if}\;\frac{x}{y \cdot 2} \le -163906923100785256247066624:\\
\;\;\;\;1\\
\mathbf{elif}\;\frac{x}{y \cdot 2} \le 150459310596020020183040:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{\cos \left(\frac{x}{y \cdot 2}\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r380515 = x;
double r380516 = y;
double r380517 = 2.0;
double r380518 = r380516 * r380517;
double r380519 = r380515 / r380518;
double r380520 = tan(r380519);
double r380521 = sin(r380519);
double r380522 = r380520 / r380521;
return r380522;
}
double f(double x, double y) {
double r380523 = x;
double r380524 = y;
double r380525 = 2.0;
double r380526 = r380524 * r380525;
double r380527 = r380523 / r380526;
double r380528 = -1.6390692310078526e+26;
bool r380529 = r380527 <= r380528;
double r380530 = 1.0;
double r380531 = 1.5045931059602002e+23;
bool r380532 = r380527 <= r380531;
double r380533 = 1.0;
double r380534 = cos(r380527);
double r380535 = r380533 / r380534;
double r380536 = expm1(r380535);
double r380537 = log1p(r380536);
double r380538 = r380532 ? r380537 : r380530;
double r380539 = r380529 ? r380530 : r380538;
return r380539;
}




Bits error versus x




Bits error versus y
Results
| Original | 35.6 |
|---|---|
| Target | 28.7 |
| Herbie | 27.1 |
if (/ x (* y 2.0)) < -1.6390692310078526e+26 or 1.5045931059602002e+23 < (/ x (* y 2.0)) Initial program 58.9
Taylor expanded around 0 56.4
if -1.6390692310078526e+26 < (/ x (* y 2.0)) < 1.5045931059602002e+23Initial program 16.0
rmApplied tan-quot16.0
Applied associate-/l/16.0
rmApplied log1p-expm1-u16.0
Simplified2.4
Final simplification27.1
herbie shell --seed 2019235 +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)))))