\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -5.90737577331802458 \cdot 10^{-57} \lor \neg \left(z \le 2.54423027784147743 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{\cosh x \cdot y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{x \cdot \frac{z}{y}}\\
\end{array}double f(double x, double y, double z) {
double r479901 = x;
double r479902 = cosh(r479901);
double r479903 = y;
double r479904 = r479903 / r479901;
double r479905 = r479902 * r479904;
double r479906 = z;
double r479907 = r479905 / r479906;
return r479907;
}
double f(double x, double y, double z) {
double r479908 = z;
double r479909 = -5.907375773318025e-57;
bool r479910 = r479908 <= r479909;
double r479911 = 2.5442302778414774e-06;
bool r479912 = r479908 <= r479911;
double r479913 = !r479912;
bool r479914 = r479910 || r479913;
double r479915 = x;
double r479916 = cosh(r479915);
double r479917 = y;
double r479918 = r479916 * r479917;
double r479919 = r479915 * r479908;
double r479920 = r479918 / r479919;
double r479921 = r479908 / r479917;
double r479922 = r479915 * r479921;
double r479923 = r479916 / r479922;
double r479924 = r479914 ? r479920 : r479923;
return r479924;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.6 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
if z < -5.907375773318025e-57 or 2.5442302778414774e-06 < z Initial program 10.7
rmApplied associate-*r/10.7
Applied associate-/l/0.4
Simplified0.4
if -5.907375773318025e-57 < z < 2.5442302778414774e-06Initial program 0.3
rmApplied associate-/l*0.4
Simplified0.4
rmApplied *-un-lft-identity0.4
Applied associate-*l*0.4
Simplified0.3
Final simplification0.4
herbie shell --seed 2020045
(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))