\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -2.56082919711251703348519476677496253443 \cdot 10^{-15} \lor \neg \left(z \le 4.489894380771518759583953311198839017656 \cdot 10^{-96}\right):\\
\;\;\;\;\frac{y \cdot \cosh x}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\cosh x \cdot \frac{\frac{y}{z}}{x}\\
\end{array}double f(double x, double y, double z) {
double r371802 = x;
double r371803 = cosh(r371802);
double r371804 = y;
double r371805 = r371804 / r371802;
double r371806 = r371803 * r371805;
double r371807 = z;
double r371808 = r371806 / r371807;
return r371808;
}
double f(double x, double y, double z) {
double r371809 = z;
double r371810 = -2.560829197112517e-15;
bool r371811 = r371809 <= r371810;
double r371812 = 4.489894380771519e-96;
bool r371813 = r371809 <= r371812;
double r371814 = !r371813;
bool r371815 = r371811 || r371814;
double r371816 = y;
double r371817 = x;
double r371818 = cosh(r371817);
double r371819 = r371816 * r371818;
double r371820 = r371817 * r371809;
double r371821 = r371819 / r371820;
double r371822 = r371816 / r371809;
double r371823 = r371822 / r371817;
double r371824 = r371818 * r371823;
double r371825 = r371815 ? r371821 : r371824;
return r371825;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.8 |
|---|---|
| Target | 0.5 |
| Herbie | 0.7 |
if z < -2.560829197112517e-15 or 4.489894380771519e-96 < z Initial program 10.5
Simplified0.9
rmApplied associate-*l/0.9
if -2.560829197112517e-15 < z < 4.489894380771519e-96Initial program 0.3
Simplified23.8
rmApplied *-un-lft-identity23.8
Applied associate-*l*23.8
Simplified0.3
Final simplification0.7
herbie shell --seed 2019194
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
: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))