\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 1.012741487861675:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{expm1}\left(\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r3771 = x;
double r3772 = y;
double r3773 = 2.0;
double r3774 = r3772 * r3773;
double r3775 = r3771 / r3774;
double r3776 = tan(r3775);
double r3777 = sin(r3775);
double r3778 = r3776 / r3777;
return r3778;
}
double f(double x, double y) {
double r3779 = x;
double r3780 = y;
double r3781 = 2.0;
double r3782 = r3780 * r3781;
double r3783 = r3779 / r3782;
double r3784 = tan(r3783);
double r3785 = sin(r3783);
double r3786 = r3784 / r3785;
double r3787 = 1.0127414878616747;
bool r3788 = r3786 <= r3787;
double r3789 = expm1(r3786);
double r3790 = expm1(r3789);
double r3791 = log1p(r3790);
double r3792 = log1p(r3791);
double r3793 = 1.0;
double r3794 = r3788 ? r3792 : r3793;
return r3794;
}




Bits error versus x




Bits error versus y
Results
| Original | 35.5 |
|---|---|
| Target | 29.0 |
| Herbie | 28.0 |
if (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))) < 1.0127414878616747Initial program 19.0
rmApplied log1p-expm1-u19.1
rmApplied log1p-expm1-u19.1
if 1.0127414878616747 < (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))) Initial program 60.1
Taylor expanded around 0 41.4
Final simplification28.0
herbie shell --seed 2020025 +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.2303690911306994e+114) 1 (if (< y -9.102852406811914e-222) (/ (sin (/ x (* y 2))) (* (sin (/ x (* y 2))) (log (exp (cos (/ x (* y 2))))))) 1))
(/ (tan (/ x (* y 2))) (sin (/ x (* y 2)))))