\frac{\tan \left(\frac{x}{y \cdot 2}\right)}{\sin \left(\frac{x}{y \cdot 2}\right)}
\begin{array}{l}
\mathbf{if}\;y \cdot 2 \leq -6.3806695735061406 \cdot 10^{-83}:\\
\;\;\;\;\frac{1}{\log \left(e^{\cos \left(0.5 \cdot \frac{x}{y}\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
(FPCore (x y) :precision binary64 (/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))))
(FPCore (x y) :precision binary64 (if (<= (* y 2.0) -6.3806695735061406e-83) (/ 1.0 (log (exp (cos (* 0.5 (/ x y)))))) 1.0))
double code(double x, double y) {
return tan(x / (y * 2.0)) / sin(x / (y * 2.0));
}
double code(double x, double y) {
double tmp;
if ((y * 2.0) <= -6.3806695735061406e-83) {
tmp = 1.0 / log(exp(cos(0.5 * (x / y))));
} else {
tmp = 1.0;
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 36.1 |
|---|---|
| Target | 29.3 |
| Herbie | 28.4 |
if (*.f64 y 2) < -6.3806695735061406e-83Initial program 29.3
Taylor expanded in x around inf 29.4
Applied add-log-exp_binary6429.4
Taylor expanded in x around inf 17.3
if -6.3806695735061406e-83 < (*.f64 y 2) Initial program 39.2
Taylor expanded in x around 0 33.6
Final simplification28.4
herbie shell --seed 2021220
(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.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)))))