\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 r411536 = x;
double r411537 = cosh(r411536);
double r411538 = y;
double r411539 = r411538 / r411536;
double r411540 = r411537 * r411539;
double r411541 = z;
double r411542 = r411540 / r411541;
return r411542;
}
double f(double x, double y, double z) {
double r411543 = z;
double r411544 = -5.663392033250732e+67;
bool r411545 = r411543 <= r411544;
double r411546 = 1.8543537535968015e+70;
bool r411547 = r411543 <= r411546;
double r411548 = !r411547;
bool r411549 = r411545 || r411548;
double r411550 = x;
double r411551 = cosh(r411550);
double r411552 = y;
double r411553 = r411550 * r411543;
double r411554 = r411552 / r411553;
double r411555 = r411551 * r411554;
double r411556 = r411552 / r411543;
double r411557 = exp(r411550);
double r411558 = 0.5;
double r411559 = r411558 / r411557;
double r411560 = fma(r411557, r411558, r411559);
double r411561 = r411556 * r411560;
double r411562 = r411561 / r411550;
double r411563 = r411549 ? r411555 : r411562;
return r411563;
}




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