\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 r374636 = x;
double r374637 = cosh(r374636);
double r374638 = y;
double r374639 = r374638 / r374636;
double r374640 = r374637 * r374639;
double r374641 = z;
double r374642 = r374640 / r374641;
return r374642;
}
double f(double x, double y, double z) {
double r374643 = z;
double r374644 = -3.3781132449665854e-37;
bool r374645 = r374643 <= r374644;
double r374646 = 1.8049362431750824e+23;
bool r374647 = r374643 <= r374646;
double r374648 = !r374647;
bool r374649 = r374645 || r374648;
double r374650 = x;
double r374651 = cosh(r374650);
double r374652 = y;
double r374653 = r374651 * r374652;
double r374654 = r374650 * r374643;
double r374655 = r374653 / r374654;
double r374656 = r374651 / r374650;
double r374657 = r374652 / r374643;
double r374658 = r374656 * r374657;
double r374659 = r374649 ? r374655 : r374658;
return r374659;
}




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))