\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -15778803037148576273221211758983643136:\\
\;\;\;\;\frac{\cosh x \cdot y}{x \cdot z}\\
\mathbf{elif}\;z \le 2.108633642705728546500571940335929006581 \cdot 10^{-48}:\\
\;\;\;\;\frac{\mathsf{fma}\left(e^{x}, \frac{1}{2}, \frac{\frac{1}{2}}{e^{x}}\right)}{\frac{x}{y} \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x \cdot y}{x \cdot z}\\
\end{array}double f(double x, double y, double z) {
double r16607245 = x;
double r16607246 = cosh(r16607245);
double r16607247 = y;
double r16607248 = r16607247 / r16607245;
double r16607249 = r16607246 * r16607248;
double r16607250 = z;
double r16607251 = r16607249 / r16607250;
return r16607251;
}
double f(double x, double y, double z) {
double r16607252 = z;
double r16607253 = -1.5778803037148576e+37;
bool r16607254 = r16607252 <= r16607253;
double r16607255 = x;
double r16607256 = cosh(r16607255);
double r16607257 = y;
double r16607258 = r16607256 * r16607257;
double r16607259 = r16607255 * r16607252;
double r16607260 = r16607258 / r16607259;
double r16607261 = 2.1086336427057285e-48;
bool r16607262 = r16607252 <= r16607261;
double r16607263 = exp(r16607255);
double r16607264 = 0.5;
double r16607265 = r16607264 / r16607263;
double r16607266 = fma(r16607263, r16607264, r16607265);
double r16607267 = r16607255 / r16607257;
double r16607268 = r16607267 * r16607252;
double r16607269 = r16607266 / r16607268;
double r16607270 = r16607262 ? r16607269 : r16607260;
double r16607271 = r16607254 ? r16607260 : r16607270;
return r16607271;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 7.9 |
|---|---|
| Target | 0.4 |
| Herbie | 0.5 |
if z < -1.5778803037148576e+37 or 2.1086336427057285e-48 < z Initial program 12.0
rmApplied associate-*r/12.0
Applied associate-/l/0.5
if -1.5778803037148576e+37 < z < 2.1086336427057285e-48Initial program 0.4
Taylor expanded around inf 0.4
Simplified0.5
rmApplied associate-/l/0.4
Final simplification0.5
herbie shell --seed 2019172 +o rules:numerics
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
:herbie-target
(if (< y -4.618902267687042e-52) (* (/ (/ y z) x) (cosh x)) (if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))