\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -3.7130412810217909 \cdot 10^{79} \lor \neg \left(z \le 4.38336286335594193 \cdot 10^{61}\right):\\
\;\;\;\;y \cdot \frac{\frac{\mathsf{fma}\left(e^{x}, \frac{1}{2}, \frac{\frac{1}{2}}{e^{x}}\right)}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{z}}{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 <= -3.713041281021791e+79) || !(z <= 4.383362863355942e+61))) {
VAR = ((double) (y * ((double) (((double) (((double) fma(((double) exp(x)), 0.5, ((double) (0.5 / ((double) exp(x)))))) / x)) / z))));
} else {
VAR = ((double) (((double) (((double) (((double) cosh(x)) * y)) / z)) / x));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.6 |
|---|---|
| Target | 0.5 |
| Herbie | 0.8 |
if z < -3.713041281021791e+79 or 4.383362863355942e+61 < z Initial program 13.4
Taylor expanded around inf 0.4
Simplified12.3
rmApplied div-inv12.4
Applied associate-*l*0.6
Simplified0.5
if -3.713041281021791e+79 < z < 4.383362863355942e+61Initial program 1.3
rmApplied div-inv1.4
rmApplied associate-*r/1.4
Applied associate-*l/1.3
Simplified1.2
Final simplification0.8
herbie shell --seed 2020122 +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))