\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 r24182933 = x;
double r24182934 = y;
double r24182935 = 2.0;
double r24182936 = r24182934 * r24182935;
double r24182937 = r24182933 / r24182936;
double r24182938 = tan(r24182937);
double r24182939 = sin(r24182937);
double r24182940 = r24182938 / r24182939;
return r24182940;
}
double f(double x, double y) {
double r24182941 = x;
double r24182942 = 2.0;
double r24182943 = y;
double r24182944 = r24182942 * r24182943;
double r24182945 = r24182941 / r24182944;
double r24182946 = tan(r24182945);
double r24182947 = sin(r24182945);
double r24182948 = r24182946 / r24182947;
double r24182949 = 2.0709470917123443;
bool r24182950 = r24182948 <= r24182949;
double r24182951 = expm1(r24182948);
double r24182952 = exp(r24182951);
double r24182953 = log(r24182952);
double r24182954 = log1p(r24182953);
double r24182955 = 1.0;
double r24182956 = r24182950 ? r24182954 : r24182955;
return r24182956;
}




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)))))