\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -1.706524267514688817080607810109361259464 \cdot 10^{-14} \lor \neg \left(z \le 1.345654323883122095521379973183563704723 \cdot 10^{50}\right):\\
\;\;\;\;\frac{\left(\frac{1}{2} \cdot \left(e^{-x} + e^{x}\right)\right) \cdot y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{2} \cdot \left(e^{-x} + e^{x}\right)}{x} \cdot \frac{y}{z}\\
\end{array}double f(double x, double y, double z) {
double r758912 = x;
double r758913 = cosh(r758912);
double r758914 = y;
double r758915 = r758914 / r758912;
double r758916 = r758913 * r758915;
double r758917 = z;
double r758918 = r758916 / r758917;
return r758918;
}
double f(double x, double y, double z) {
double r758919 = z;
double r758920 = -1.7065242675146888e-14;
bool r758921 = r758919 <= r758920;
double r758922 = 1.345654323883122e+50;
bool r758923 = r758919 <= r758922;
double r758924 = !r758923;
bool r758925 = r758921 || r758924;
double r758926 = 0.5;
double r758927 = x;
double r758928 = -r758927;
double r758929 = exp(r758928);
double r758930 = exp(r758927);
double r758931 = r758929 + r758930;
double r758932 = r758926 * r758931;
double r758933 = y;
double r758934 = r758932 * r758933;
double r758935 = r758927 * r758919;
double r758936 = r758934 / r758935;
double r758937 = r758932 / r758927;
double r758938 = r758933 / r758919;
double r758939 = r758937 * r758938;
double r758940 = r758925 ? r758936 : r758939;
return r758940;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.8 |
|---|---|
| Target | 0.5 |
| Herbie | 0.4 |
if z < -1.7065242675146888e-14 or 1.345654323883122e+50 < z Initial program 12.1
Taylor expanded around inf 0.3
Simplified12.2
rmApplied *-un-lft-identity12.2
Applied associate-/r/12.2
Applied times-frac11.4
Simplified11.4
rmApplied frac-times0.3
if -1.7065242675146888e-14 < z < 1.345654323883122e+50Initial program 0.6
Taylor expanded around inf 17.6
Simplified0.7
rmApplied *-un-lft-identity0.7
Applied associate-/r/0.7
Applied times-frac0.5
Simplified0.5
Final simplification0.4
herbie shell --seed 2019305 +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))