\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -4.4738653069367457 \cdot 10^{56}:\\
\;\;\;\;\frac{\frac{1}{2} \cdot \left(e^{-1 \cdot x} + e^{x}\right)}{z \cdot x} \cdot y\\
\mathbf{elif}\;z \le 5.00638161210447719 \cdot 10^{-8}:\\
\;\;\;\;\frac{\frac{y}{x} + \frac{1}{2} \cdot \left(x \cdot y\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2} \cdot \left(x \cdot \frac{y}{z}\right) + \frac{y}{x \cdot z}\\
\end{array}double code(double x, double y, double z) {
return ((cosh(x) * (y / x)) / z);
}
double code(double x, double y, double z) {
double temp;
if ((z <= -4.473865306936746e+56)) {
temp = (((0.5 * (exp((-1.0 * x)) + exp(x))) / (z * x)) * y);
} else {
double temp_1;
if ((z <= 5.006381612104477e-08)) {
temp_1 = (((y / x) + (0.5 * (x * y))) / z);
} else {
temp_1 = ((0.5 * (x * (y / z))) + (y / (x * z)));
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.9 |
|---|---|
| Target | 0.5 |
| Herbie | 1.1 |
if z < -4.473865306936746e+56Initial program 13.8
Taylor expanded around inf 0.4
Simplified0.7
rmApplied associate-/r/0.4
if -4.473865306936746e+56 < z < 5.006381612104477e-08Initial program 0.8
Taylor expanded around 0 1.8
if 5.006381612104477e-08 < z Initial program 11.6
Taylor expanded around 0 1.0
rmApplied *-un-lft-identity1.0
Applied times-frac1.0
Simplified1.0
Final simplification1.1
herbie shell --seed 2020060
(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))