\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -813868602.68375670909881591796875 \lor \neg \left(z \le 2.464261935710089975344020916546644554505 \cdot 10^{44}\right):\\
\;\;\;\;\left(\cosh x \cdot y\right) \cdot \frac{1}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{2} \cdot \left(e^{x} + e^{-x}\right)}{z \cdot \frac{x}{y}}\\
\end{array}double f(double x, double y, double z) {
double r342819 = x;
double r342820 = cosh(r342819);
double r342821 = y;
double r342822 = r342821 / r342819;
double r342823 = r342820 * r342822;
double r342824 = z;
double r342825 = r342823 / r342824;
return r342825;
}
double f(double x, double y, double z) {
double r342826 = z;
double r342827 = -813868602.6837567;
bool r342828 = r342826 <= r342827;
double r342829 = 2.46426193571009e+44;
bool r342830 = r342826 <= r342829;
double r342831 = !r342830;
bool r342832 = r342828 || r342831;
double r342833 = x;
double r342834 = cosh(r342833);
double r342835 = y;
double r342836 = r342834 * r342835;
double r342837 = 1.0;
double r342838 = r342826 * r342833;
double r342839 = r342837 / r342838;
double r342840 = r342836 * r342839;
double r342841 = 0.5;
double r342842 = exp(r342833);
double r342843 = -r342833;
double r342844 = exp(r342843);
double r342845 = r342842 + r342844;
double r342846 = r342841 * r342845;
double r342847 = r342833 / r342835;
double r342848 = r342826 * r342847;
double r342849 = r342846 / r342848;
double r342850 = r342832 ? r342840 : r342849;
return r342850;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.9 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
if z < -813868602.6837567 or 2.46426193571009e+44 < z Initial program 13.0
rmApplied associate-*r/13.0
Applied associate-/l/0.3
rmApplied div-inv0.4
if -813868602.6837567 < z < 2.46426193571009e+44Initial program 0.5
rmApplied associate-*r/0.5
Applied associate-/l/17.1
rmApplied div-inv18.9
Taylor expanded around inf 17.1
Simplified17.1
rmApplied *-un-lft-identity17.1
Applied times-frac0.5
Simplified0.5
Final simplification0.4
herbie shell --seed 2019208 +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.03853053593515302e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))