\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -1.28840821850656701 \cdot 10^{-48} \lor \neg \left(z \le 4.15578969436787686 \cdot 10^{-38}\right):\\
\;\;\;\;\frac{\cosh x \cdot y}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\cosh x \cdot y\right) \cdot \frac{1}{x}}{z}\\
\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 temp;
if (((z <= -1.288408218506567e-48) || !(z <= 4.155789694367877e-38))) {
temp = ((cosh(x) * y) / (z * x));
} else {
temp = (((cosh(x) * y) * (1.0 / x)) / z);
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.5 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
if z < -1.288408218506567e-48 or 4.155789694367877e-38 < z Initial program 10.2
rmApplied associate-*r/10.2
Applied associate-/l/0.5
if -1.288408218506567e-48 < z < 4.155789694367877e-38Initial program 0.3
rmApplied div-inv0.4
Applied associate-*r*0.4
Final simplification0.4
herbie shell --seed 2020058 +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))