\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -1.615131604836802622424408328927110030211 \cdot 10^{-74}:\\
\;\;\;\;\frac{\left(e^{x} + e^{-x}\right) \cdot y}{z \cdot \left(2 \cdot x\right)}\\
\mathbf{elif}\;z \le 3.366351636300589121970729979201097827583 \cdot 10^{-14}:\\
\;\;\;\;\frac{\left(e^{x} + e^{-x}\right) \cdot \frac{\frac{y}{x}}{z}}{2}\\
\mathbf{else}:\\
\;\;\;\;\left(\cosh x \cdot y\right) \cdot \frac{\frac{1}{x}}{z}\\
\end{array}double f(double x, double y, double z) {
double r574934 = x;
double r574935 = cosh(r574934);
double r574936 = y;
double r574937 = r574936 / r574934;
double r574938 = r574935 * r574937;
double r574939 = z;
double r574940 = r574938 / r574939;
return r574940;
}
double f(double x, double y, double z) {
double r574941 = z;
double r574942 = -1.6151316048368026e-74;
bool r574943 = r574941 <= r574942;
double r574944 = x;
double r574945 = exp(r574944);
double r574946 = -r574944;
double r574947 = exp(r574946);
double r574948 = r574945 + r574947;
double r574949 = y;
double r574950 = r574948 * r574949;
double r574951 = 2.0;
double r574952 = r574951 * r574944;
double r574953 = r574941 * r574952;
double r574954 = r574950 / r574953;
double r574955 = 3.366351636300589e-14;
bool r574956 = r574941 <= r574955;
double r574957 = r574949 / r574944;
double r574958 = r574957 / r574941;
double r574959 = r574948 * r574958;
double r574960 = r574959 / r574951;
double r574961 = cosh(r574944);
double r574962 = r574961 * r574949;
double r574963 = 1.0;
double r574964 = r574963 / r574944;
double r574965 = r574964 / r574941;
double r574966 = r574962 * r574965;
double r574967 = r574956 ? r574960 : r574966;
double r574968 = r574943 ? r574954 : r574967;
return r574968;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 8.3 |
|---|---|
| Target | 0.5 |
| Herbie | 0.6 |
if z < -1.6151316048368026e-74Initial program 11.7
rmApplied cosh-def11.7
Applied frac-times11.7
Applied associate-/l/0.8
if -1.6151316048368026e-74 < z < 3.366351636300589e-14Initial program 0.3
rmApplied *-un-lft-identity0.3
Applied times-frac0.3
Simplified0.3
rmApplied cosh-def0.3
Applied associate-*l/0.4
if 3.366351636300589e-14 < z Initial program 11.0
rmApplied *-un-lft-identity11.0
Applied times-frac11.0
Simplified11.0
rmApplied *-un-lft-identity11.0
Applied div-inv11.1
Applied times-frac0.5
Applied associate-*r*0.5
Simplified0.5
Final simplification0.6
herbie shell --seed 2019351 +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))