\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.380070659087056:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\sin \left(\frac{x}{y \cdot 2}\right)}{\cos \left(\frac{x}{y \cdot 2}\right)}\right)\right)}{\sin \left(\frac{x}{y \cdot 2}\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r676248 = x;
double r676249 = y;
double r676250 = 2.0;
double r676251 = r676249 * r676250;
double r676252 = r676248 / r676251;
double r676253 = tan(r676252);
double r676254 = sin(r676252);
double r676255 = r676253 / r676254;
return r676255;
}
double f(double x, double y) {
double r676256 = x;
double r676257 = y;
double r676258 = 2.0;
double r676259 = r676257 * r676258;
double r676260 = r676256 / r676259;
double r676261 = tan(r676260);
double r676262 = sin(r676260);
double r676263 = r676261 / r676262;
double r676264 = 1.380070659087056;
bool r676265 = r676263 <= r676264;
double r676266 = cos(r676260);
double r676267 = r676262 / r676266;
double r676268 = expm1(r676267);
double r676269 = log1p(r676268);
double r676270 = r676269 / r676262;
double r676271 = expm1(r676270);
double r676272 = log1p(r676271);
double r676273 = 1.0;
double r676274 = r676265 ? r676272 : r676273;
return r676274;
}




Bits error versus x




Bits error versus y
Results
| Original | 36.1 |
|---|---|
| Target | 29.5 |
| Herbie | 28.3 |
if (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))) < 1.380070659087056Initial program 23.4
rmApplied log1p-expm1-u23.4
rmApplied log1p-expm1-u23.4
rmApplied tan-quot23.4
if 1.380070659087056 < (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))) Initial program 61.3
Taylor expanded around 0 37.9
Final simplification28.3
herbie shell --seed 2020036 +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)))))