\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -1.52418616689956927 \cdot 10^{-6} \lor \neg \left(z \le 846000653.470597625\right):\\
\;\;\;\;\frac{\cosh x \cdot y}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z} \cdot \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 ((double) (((double) (((double) cosh(x)) * ((double) (y / x)))) / z));
}
double code(double x, double y, double z) {
double VAR;
if (((z <= -1.5241861668995693e-06) || !(z <= 846000653.4705976))) {
VAR = ((double) (((double) (((double) cosh(x)) * y)) / ((double) (z * x))));
} else {
VAR = ((double) (((double) (((double) (y / z)) * ((double) fma(((double) exp(x)), 0.5, ((double) (0.5 / ((double) exp(x)))))))) / x));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 8.0 |
|---|---|
| Target | 0.4 |
| Herbie | 0.3 |
if z < -1.5241861668995693e-06 or 846000653.4705976 < z Initial program 12.1
rmApplied associate-*r/12.1
Applied associate-/l/0.3
if -1.5241861668995693e-06 < z < 846000653.4705976Initial program 0.3
Taylor expanded around inf 20.2
Simplified0.4
rmApplied associate-*r/0.3
Final simplification0.3
herbie shell --seed 2020121 +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))