\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)}\begin{array}{l}
\mathbf{if}\;\frac{\tan \left(\frac{x}{2 \cdot y}\right)}{\sin \left(\frac{x}{2 \cdot y}\right)} \le 2.070947091712344256819733345764689147472:\\
\;\;\;\;\mathsf{log1p}\left(\log \left(e^{\mathsf{expm1}\left(\frac{\tan \left(\frac{x}{2 \cdot y}\right)}{\sin \left(\frac{x}{2 \cdot y}\right)}\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r28577089 = x;
double r28577090 = y;
double r28577091 = 2.0;
double r28577092 = r28577090 * r28577091;
double r28577093 = r28577089 / r28577092;
double r28577094 = tan(r28577093);
double r28577095 = sin(r28577093);
double r28577096 = r28577094 / r28577095;
return r28577096;
}
double f(double x, double y) {
double r28577097 = x;
double r28577098 = 2.0;
double r28577099 = y;
double r28577100 = r28577098 * r28577099;
double r28577101 = r28577097 / r28577100;
double r28577102 = tan(r28577101);
double r28577103 = sin(r28577101);
double r28577104 = r28577102 / r28577103;
double r28577105 = 2.0709470917123443;
bool r28577106 = r28577104 <= r28577105;
double r28577107 = expm1(r28577104);
double r28577108 = exp(r28577107);
double r28577109 = log(r28577108);
double r28577110 = log1p(r28577109);
double r28577111 = 1.0;
double r28577112 = r28577106 ? r28577110 : r28577111;
return r28577112;
}




Bits error versus x




Bits error versus y
Results
| Original | 35.6 |
|---|---|
| Target | 29.2 |
| Herbie | 28.0 |
if (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))) < 2.0709470917123443Initial program 24.7
rmApplied log1p-expm1-u24.7
rmApplied add-log-exp24.7
if 2.0709470917123443 < (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))) Initial program 62.2
Taylor expanded around 0 35.8
Final simplification28.0
herbie shell --seed 2019200 +o rules:numerics
(FPCore (x y)
:name "Diagrams.TwoD.Layout.CirclePacking:approxRadius from diagrams-contrib-1.3.0.5"
:herbie-target
(if (< y -1.2303690911306994e+114) 1.0 (if (< y -9.102852406811914e-222) (/ (sin (/ x (* y 2.0))) (* (sin (/ x (* y 2.0))) (log (exp (cos (/ x (* y 2.0))))))) 1.0))
(/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))))