\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -813868602.68375670909881591796875 \lor \neg \left(z \le 2.464261935710089975344020916546644554505 \cdot 10^{44}\right):\\
\;\;\;\;\left(\cosh x \cdot y\right) \cdot \frac{1}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{2} \cdot \left(e^{-x} + e^{x}\right)}{z \cdot \frac{x}{y}}\\
\end{array}double f(double x, double y, double z) {
double r362080 = x;
double r362081 = cosh(r362080);
double r362082 = y;
double r362083 = r362082 / r362080;
double r362084 = r362081 * r362083;
double r362085 = z;
double r362086 = r362084 / r362085;
return r362086;
}
double f(double x, double y, double z) {
double r362087 = z;
double r362088 = -813868602.6837567;
bool r362089 = r362087 <= r362088;
double r362090 = 2.46426193571009e+44;
bool r362091 = r362087 <= r362090;
double r362092 = !r362091;
bool r362093 = r362089 || r362092;
double r362094 = x;
double r362095 = cosh(r362094);
double r362096 = y;
double r362097 = r362095 * r362096;
double r362098 = 1.0;
double r362099 = r362087 * r362094;
double r362100 = r362098 / r362099;
double r362101 = r362097 * r362100;
double r362102 = 0.5;
double r362103 = -r362094;
double r362104 = exp(r362103);
double r362105 = exp(r362094);
double r362106 = r362104 + r362105;
double r362107 = r362102 * r362106;
double r362108 = r362094 / r362096;
double r362109 = r362087 * r362108;
double r362110 = r362107 / r362109;
double r362111 = r362093 ? r362101 : r362110;
return r362111;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.9 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
if z < -813868602.6837567 or 2.46426193571009e+44 < z Initial program 13.0
rmApplied associate-*r/13.0
Applied associate-/l/0.3
rmApplied div-inv0.4
if -813868602.6837567 < z < 2.46426193571009e+44Initial program 0.5
Taylor expanded around inf 17.1
Simplified17.1
rmApplied *-un-lft-identity17.1
Applied times-frac0.5
Simplified0.5
Final simplification0.4
herbie shell --seed 2019208
(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))