\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -5.663392033250732015294860045286254482681 \cdot 10^{67} \lor \neg \left(z \le 1.854353753596801523136697556389482635506 \cdot 10^{70}\right):\\
\;\;\;\;\cosh x \cdot \frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z} \cdot \mathsf{fma}\left(e^{x}, \frac{1}{2}, \frac{\frac{1}{2}}{e^{x}}\right)}{x}\\
\end{array}double f(double x, double y, double z) {
double r451423 = x;
double r451424 = cosh(r451423);
double r451425 = y;
double r451426 = r451425 / r451423;
double r451427 = r451424 * r451426;
double r451428 = z;
double r451429 = r451427 / r451428;
return r451429;
}
double f(double x, double y, double z) {
double r451430 = z;
double r451431 = -5.663392033250732e+67;
bool r451432 = r451430 <= r451431;
double r451433 = 1.8543537535968015e+70;
bool r451434 = r451430 <= r451433;
double r451435 = !r451434;
bool r451436 = r451432 || r451435;
double r451437 = x;
double r451438 = cosh(r451437);
double r451439 = y;
double r451440 = r451437 * r451430;
double r451441 = r451439 / r451440;
double r451442 = r451438 * r451441;
double r451443 = r451439 / r451430;
double r451444 = exp(r451437);
double r451445 = 0.5;
double r451446 = r451445 / r451444;
double r451447 = fma(r451444, r451445, r451446);
double r451448 = r451443 * r451447;
double r451449 = r451448 / r451437;
double r451450 = r451436 ? r451442 : r451449;
return r451450;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 8.1 |
|---|---|
| Target | 0.4 |
| Herbie | 0.7 |
if z < -5.663392033250732e+67 or 1.8543537535968015e+70 < z Initial program 14.6
rmApplied *-un-lft-identity14.6
Applied times-frac14.6
Simplified14.6
Simplified0.3
rmApplied *-un-lft-identity0.3
Applied times-frac11.7
rmApplied frac-times0.3
Simplified0.3
if -5.663392033250732e+67 < z < 1.8543537535968015e+70Initial program 1.4
rmApplied *-un-lft-identity1.4
Applied times-frac1.4
Simplified1.4
Simplified13.9
Taylor expanded around inf 13.9
Simplified1.2
Final simplification0.7
herbie shell --seed 2020001 +o rules:numerics
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< y -4.618902267687042e-52) (* (/ (/ y z) x) (cosh x)) (if (< y 1.0385305359351529e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))