\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -1.75076129698449564 \cdot 10^{-50} \lor \neg \left(z \le 9.6050466922063675 \cdot 10^{-58}\right):\\
\;\;\;\;\cosh x \cdot \frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{\mathsf{fma}\left(e^{x}, \frac{1}{2}, \frac{\frac{1}{2}}{e^{x}}\right)}{x}\\
\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 VAR;
if (((z <= -1.7507612969844956e-50) || !(z <= 9.605046692206368e-58))) {
VAR = (cosh(x) * (y / (x * z)));
} else {
VAR = ((y / z) * (fma(exp(x), 0.5, (0.5 / exp(x))) / x));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.8 |
|---|---|
| Target | 0.5 |
| Herbie | 0.5 |
if z < -1.7507612969844956e-50 or 9.605046692206368e-58 < z Initial program 10.5
rmApplied *-un-lft-identity10.5
Applied times-frac10.5
Simplified10.5
Simplified0.6
if -1.7507612969844956e-50 < z < 9.605046692206368e-58Initial program 0.3
Taylor expanded around inf 25.0
Simplified0.4
Final simplification0.5
herbie shell --seed 2020079 +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))