\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -1.14904344650051927 \cdot 10^{47} \lor \neg \left(z \le 396504734138806976\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{2}, \frac{x \cdot y}{z}, \frac{y}{x \cdot z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x \cdot \frac{y}{x}}{z}\\
\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.1490434465005193e+47) || !(z <= 3.96504734138807e+17))) {
VAR = ((double) fma(0.5, ((double) (((double) (x * y)) / z)), ((double) (y / ((double) (x * z))))));
} else {
VAR = ((double) (((double) (((double) cosh(x)) * ((double) (y / x)))) / z));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.8 |
|---|---|
| Target | 0.4 |
| Herbie | 0.7 |
if z < -1.1490434465005193e+47 or 3.96504734138807e+17 < z Initial program 12.9
Taylor expanded around 0 0.8
Simplified0.8
if -1.1490434465005193e+47 < z < 3.96504734138807e+17Initial program 0.5
Final simplification0.7
herbie shell --seed 2020114 +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))