\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -1948241059787096980000 \lor \neg \left(z \le 7.2256649558957228 \cdot 10^{-45}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{2}, e^{-1 \cdot x}, \frac{1}{2} \cdot e^{x}\right) \cdot \frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(e^{x} + e^{-x}\right) \cdot \frac{y}{z}}{2 \cdot x}\\
\end{array}double f(double x, double y, double z) {
double r546752 = x;
double r546753 = cosh(r546752);
double r546754 = y;
double r546755 = r546754 / r546752;
double r546756 = r546753 * r546755;
double r546757 = z;
double r546758 = r546756 / r546757;
return r546758;
}
double f(double x, double y, double z) {
double r546759 = z;
double r546760 = -1.948241059787097e+21;
bool r546761 = r546759 <= r546760;
double r546762 = 7.225664955895723e-45;
bool r546763 = r546759 <= r546762;
double r546764 = !r546763;
bool r546765 = r546761 || r546764;
double r546766 = 0.5;
double r546767 = -1.0;
double r546768 = x;
double r546769 = r546767 * r546768;
double r546770 = exp(r546769);
double r546771 = exp(r546768);
double r546772 = r546766 * r546771;
double r546773 = fma(r546766, r546770, r546772);
double r546774 = y;
double r546775 = r546768 * r546759;
double r546776 = r546774 / r546775;
double r546777 = r546773 * r546776;
double r546778 = -r546768;
double r546779 = exp(r546778);
double r546780 = r546771 + r546779;
double r546781 = r546774 / r546759;
double r546782 = r546780 * r546781;
double r546783 = 2.0;
double r546784 = r546783 * r546768;
double r546785 = r546782 / r546784;
double r546786 = r546765 ? r546777 : r546785;
return r546786;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 7.9 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
if z < -1.948241059787097e+21 or 7.225664955895723e-45 < z Initial program 11.8
rmApplied div-inv11.9
rmApplied cosh-def11.9
Applied frac-times11.9
Applied associate-*l/10.1
Simplified10.0
rmApplied *-un-lft-identity10.0
Applied times-frac10.0
Applied times-frac10.0
Simplified10.0
Simplified0.4
if -1.948241059787097e+21 < z < 7.225664955895723e-45Initial program 0.4
rmApplied div-inv0.5
rmApplied cosh-def0.5
Applied frac-times0.5
Applied associate-*l/0.4
Simplified0.3
rmApplied *-un-lft-identity0.3
Applied times-frac0.3
Simplified0.3
Final simplification0.4
herbie shell --seed 2020039 +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))