\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}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)} \le 2.168131007224150419432362468796782195568:\\
\;\;\;\;\frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\tan \left(\frac{x}{y \cdot 2}\right)\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r449440 = x;
double r449441 = y;
double r449442 = 2.0;
double r449443 = r449441 * r449442;
double r449444 = r449440 / r449443;
double r449445 = tan(r449444);
double r449446 = sin(r449444);
double r449447 = r449445 / r449446;
return r449447;
}
double f(double x, double y) {
double r449448 = x;
double r449449 = y;
double r449450 = 2.0;
double r449451 = r449449 * r449450;
double r449452 = r449448 / r449451;
double r449453 = tan(r449452);
double r449454 = sin(r449452);
double r449455 = r449453 / r449454;
double r449456 = 2.1681310072241504;
bool r449457 = r449455 <= r449456;
double r449458 = expm1(r449453);
double r449459 = log1p(r449458);
double r449460 = r449459 / r449454;
double r449461 = 1.0;
double r449462 = r449457 ? r449460 : r449461;
return r449462;
}




Bits error versus x




Bits error versus y
Results
| Original | 35.7 |
|---|---|
| Target | 29.1 |
| Herbie | 27.8 |
if (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))) < 2.1681310072241504Initial program 25.0
rmApplied log1p-expm1-u25.1
if 2.1681310072241504 < (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))) Initial program 62.4
Taylor expanded around 0 34.6
Final simplification27.8
herbie shell --seed 2019306 +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)))))