\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -9.750320107203263883619067878118478993193 \cdot 10^{90} \lor \neg \left(z \le 18485054819100778299392\right):\\
\;\;\;\;\frac{y}{\frac{z \cdot x}{\frac{1}{2} \cdot \left(e^{-x} + e^{x}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(e^{x} + e^{-x}\right) \cdot y}{z}}{2 \cdot x}\\
\end{array}double f(double x, double y, double z) {
double r312081 = x;
double r312082 = cosh(r312081);
double r312083 = y;
double r312084 = r312083 / r312081;
double r312085 = r312082 * r312084;
double r312086 = z;
double r312087 = r312085 / r312086;
return r312087;
}
double f(double x, double y, double z) {
double r312088 = z;
double r312089 = -9.750320107203264e+90;
bool r312090 = r312088 <= r312089;
double r312091 = 1.8485054819100778e+22;
bool r312092 = r312088 <= r312091;
double r312093 = !r312092;
bool r312094 = r312090 || r312093;
double r312095 = y;
double r312096 = x;
double r312097 = r312088 * r312096;
double r312098 = 0.5;
double r312099 = -r312096;
double r312100 = exp(r312099);
double r312101 = exp(r312096);
double r312102 = r312100 + r312101;
double r312103 = r312098 * r312102;
double r312104 = r312097 / r312103;
double r312105 = r312095 / r312104;
double r312106 = r312101 + r312100;
double r312107 = r312106 * r312095;
double r312108 = r312107 / r312088;
double r312109 = 2.0;
double r312110 = r312109 * r312096;
double r312111 = r312108 / r312110;
double r312112 = r312094 ? r312105 : r312111;
return r312112;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.8 |
|---|---|
| Target | 0.5 |
| Herbie | 0.6 |
if z < -9.750320107203264e+90 or 1.8485054819100778e+22 < z Initial program 13.2
rmApplied cosh-def13.2
Applied frac-times13.2
Applied associate-/l/0.4
rmApplied add-sqr-sqrt1.2
Applied associate-*l*0.9
Taylor expanded around inf 0.4
Simplified0.3
if -9.750320107203264e+90 < z < 1.8485054819100778e+22Initial program 1.3
rmApplied cosh-def1.3
Applied frac-times1.3
Applied associate-/l/14.4
rmApplied associate-/r*1.0
Final simplification0.6
herbie shell --seed 2019209 +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))