\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 r440526 = x;
double r440527 = cosh(r440526);
double r440528 = y;
double r440529 = r440528 / r440526;
double r440530 = r440527 * r440529;
double r440531 = z;
double r440532 = r440530 / r440531;
return r440532;
}
double f(double x, double y, double z) {
double r440533 = z;
double r440534 = -5.663392033250732e+67;
bool r440535 = r440533 <= r440534;
double r440536 = 1.8543537535968015e+70;
bool r440537 = r440533 <= r440536;
double r440538 = !r440537;
bool r440539 = r440535 || r440538;
double r440540 = x;
double r440541 = cosh(r440540);
double r440542 = y;
double r440543 = r440540 * r440533;
double r440544 = r440542 / r440543;
double r440545 = r440541 * r440544;
double r440546 = r440542 / r440533;
double r440547 = exp(r440540);
double r440548 = 0.5;
double r440549 = r440548 / r440547;
double r440550 = fma(r440547, r440548, r440549);
double r440551 = r440546 * r440550;
double r440552 = r440551 / r440540;
double r440553 = r440539 ? r440545 : r440552;
return r440553;
}




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))