\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -712742474614758 \lor \neg \left(z \le 3.970994457643005255735446389224709150426 \cdot 10^{112}\right):\\
\;\;\;\;\frac{e^{x} + e^{-x}}{z \cdot \left(2 \cdot x\right)} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(e^{x} + e^{-x}\right) \cdot y}{z}}{2 \cdot x}\\
\end{array}double f(double x, double y, double z) {
double r338922 = x;
double r338923 = cosh(r338922);
double r338924 = y;
double r338925 = r338924 / r338922;
double r338926 = r338923 * r338925;
double r338927 = z;
double r338928 = r338926 / r338927;
return r338928;
}
double f(double x, double y, double z) {
double r338929 = z;
double r338930 = -712742474614758.0;
bool r338931 = r338929 <= r338930;
double r338932 = 3.970994457643005e+112;
bool r338933 = r338929 <= r338932;
double r338934 = !r338933;
bool r338935 = r338931 || r338934;
double r338936 = x;
double r338937 = exp(r338936);
double r338938 = -r338936;
double r338939 = exp(r338938);
double r338940 = r338937 + r338939;
double r338941 = 2.0;
double r338942 = r338941 * r338936;
double r338943 = r338929 * r338942;
double r338944 = r338940 / r338943;
double r338945 = y;
double r338946 = r338944 * r338945;
double r338947 = r338940 * r338945;
double r338948 = r338947 / r338929;
double r338949 = r338948 / r338942;
double r338950 = r338935 ? r338946 : r338949;
return r338950;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.8 |
|---|---|
| Target | 0.5 |
| Herbie | 1.0 |
if z < -712742474614758.0 or 3.970994457643005e+112 < z Initial program 13.3
rmApplied cosh-def13.3
Applied frac-times13.3
Applied associate-/l/0.4
rmApplied associate-/l*0.8
rmApplied associate-/r/0.4
if -712742474614758.0 < z < 3.970994457643005e+112Initial program 1.8
rmApplied cosh-def1.8
Applied frac-times1.8
Applied associate-/l/14.0
rmApplied associate-/r*1.6
Final simplification1.0
herbie shell --seed 2019303 +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.03853053593515302e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))