\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -1.4097270866768739 \cdot 10^{-11} \lor \neg \left(z \le 2.4378260307965419 \cdot 10^{-107}\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(e^{x}, y, \frac{y}{e^{x}}\right)}{\left(2 \cdot x\right) \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{x}}{z}\\
\end{array}double f(double x, double y, double z) {
double r481970 = x;
double r481971 = cosh(r481970);
double r481972 = y;
double r481973 = r481972 / r481970;
double r481974 = r481971 * r481973;
double r481975 = z;
double r481976 = r481974 / r481975;
return r481976;
}
double f(double x, double y, double z) {
double r481977 = z;
double r481978 = -1.409727086676874e-11;
bool r481979 = r481977 <= r481978;
double r481980 = 2.437826030796542e-107;
bool r481981 = r481977 <= r481980;
double r481982 = !r481981;
bool r481983 = r481979 || r481982;
double r481984 = x;
double r481985 = exp(r481984);
double r481986 = y;
double r481987 = r481986 / r481985;
double r481988 = fma(r481985, r481986, r481987);
double r481989 = 2.0;
double r481990 = r481989 * r481984;
double r481991 = r481990 * r481977;
double r481992 = r481988 / r481991;
double r481993 = cosh(r481984);
double r481994 = r481993 * r481986;
double r481995 = r481994 / r481984;
double r481996 = r481995 / r481977;
double r481997 = r481983 ? r481992 : r481996;
return r481997;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 7.5 |
|---|---|
| Target | 0.4 |
| Herbie | 0.7 |
if z < -1.409727086676874e-11 or 2.437826030796542e-107 < z Initial program 10.1
rmApplied div-inv10.2
rmApplied div-inv10.2
Applied associate-*r*10.2
rmApplied cosh-def10.2
Applied associate-*l/10.2
Applied frac-times10.2
Applied frac-times0.9
Simplified0.9
if -1.409727086676874e-11 < z < 2.437826030796542e-107Initial program 0.3
rmApplied div-inv0.4
rmApplied div-inv0.5
Applied associate-*r*0.5
rmApplied associate-*r/0.4
Simplified0.3
Final simplification0.7
herbie shell --seed 2020018 +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))