\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -3.378113244966585428960316749794424299186 \cdot 10^{-37} \lor \neg \left(z \le 180493624317508243685376\right):\\
\;\;\;\;\frac{\cosh x \cdot y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{x} \cdot \frac{y}{z}\\
\end{array}double f(double x, double y, double z) {
double r334933 = x;
double r334934 = cosh(r334933);
double r334935 = y;
double r334936 = r334935 / r334933;
double r334937 = r334934 * r334936;
double r334938 = z;
double r334939 = r334937 / r334938;
return r334939;
}
double f(double x, double y, double z) {
double r334940 = z;
double r334941 = -3.3781132449665854e-37;
bool r334942 = r334940 <= r334941;
double r334943 = 1.8049362431750824e+23;
bool r334944 = r334940 <= r334943;
double r334945 = !r334944;
bool r334946 = r334942 || r334945;
double r334947 = x;
double r334948 = cosh(r334947);
double r334949 = y;
double r334950 = r334948 * r334949;
double r334951 = r334947 * r334940;
double r334952 = r334950 / r334951;
double r334953 = r334948 / r334947;
double r334954 = r334949 / r334940;
double r334955 = r334953 * r334954;
double r334956 = r334946 ? r334952 : r334955;
return r334956;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.5 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
if z < -3.3781132449665854e-37 or 1.8049362431750824e+23 < z Initial program 11.3
rmApplied associate-*r/11.3
Applied associate-/l/0.4
Simplified0.4
if -3.3781132449665854e-37 < z < 1.8049362431750824e+23Initial program 0.4
rmApplied associate-*r/0.4
Applied associate-/l/19.6
Simplified19.6
rmApplied times-frac0.4
Final simplification0.4
herbie shell --seed 2019323 +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.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))