\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;\cosh x \cdot \frac{y}{x} \le -6.9485940714744041 \cdot 10^{277} \lor \neg \left(\cosh x \cdot \frac{y}{x} \le 7.54740556372758867 \cdot 10^{214}\right):\\
\;\;\;\;\frac{1}{x} \cdot \left(\frac{\frac{1}{2}}{\frac{z}{e^{-1 \cdot x} + e^{x}}} \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x \cdot \frac{y}{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 ((((cosh(x) * (y / x)) <= -6.948594071474404e+277) || !((cosh(x) * (y / x)) <= 7.547405563727589e+214))) {
temp = ((1.0 / x) * ((0.5 / (z / (exp((-1.0 * x)) + exp(x)))) * y));
} else {
temp = ((cosh(x) * (y / x)) / z);
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.9 |
|---|---|
| Target | 0.5 |
| Herbie | 0.4 |
if (* (cosh x) (/ y x)) < -6.948594071474404e+277 or 7.547405563727589e+214 < (* (cosh x) (/ y x)) Initial program 38.7
Taylor expanded around inf 0.8
Simplified0.6
rmApplied *-un-lft-identity0.6
Applied times-frac35.0
Applied associate-/r*35.0
Simplified35.0
rmApplied div-inv35.0
Applied *-un-lft-identity35.0
Applied *-un-lft-identity35.0
Applied times-frac35.0
Applied *-un-lft-identity35.0
Applied times-frac35.0
Applied times-frac0.9
Simplified0.9
Simplified0.9
if -6.948594071474404e+277 < (* (cosh x) (/ y x)) < 7.547405563727589e+214Initial program 0.2
Final simplification0.4
herbie shell --seed 2020053
(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))