\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.69286171955532038779779213655274361372:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{expm1}\left(\frac{\tan \left(\frac{\frac{x}{y}}{2}\right)}{\sin \left(\frac{\frac{x}{y}}{2}\right)}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r436220 = x;
double r436221 = y;
double r436222 = 2.0;
double r436223 = r436221 * r436222;
double r436224 = r436220 / r436223;
double r436225 = tan(r436224);
double r436226 = sin(r436224);
double r436227 = r436225 / r436226;
return r436227;
}
double f(double x, double y) {
double r436228 = x;
double r436229 = 2.0;
double r436230 = y;
double r436231 = r436229 * r436230;
double r436232 = r436228 / r436231;
double r436233 = tan(r436232);
double r436234 = sin(r436232);
double r436235 = r436233 / r436234;
double r436236 = 2.6928617195553204;
bool r436237 = r436235 <= r436236;
double r436238 = r436228 / r436230;
double r436239 = r436238 / r436229;
double r436240 = tan(r436239);
double r436241 = sin(r436239);
double r436242 = r436240 / r436241;
double r436243 = expm1(r436242);
double r436244 = expm1(r436243);
double r436245 = log1p(r436244);
double r436246 = log1p(r436245);
double r436247 = 1.0;
double r436248 = r436237 ? r436246 : r436247;
return r436248;
}




Bits error versus x




Bits error versus y
Results
| Original | 35.4 |
|---|---|
| Target | 28.9 |
| Herbie | 27.5 |
if (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))) < 2.6928617195553204Initial program 24.9
Simplified24.9
rmApplied log1p-expm1-u24.9
rmApplied add-cbrt-cube45.7
Applied add-cbrt-cube45.2
Applied cbrt-undiv45.2
Simplified24.9
rmApplied log1p-expm1-u24.9
Simplified24.9
if 2.6928617195553204 < (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))) Initial program 62.7
Simplified62.7
Taylor expanded around 0 34.1
Final simplification27.5
herbie shell --seed 2019179 +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)))))