\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -3780519785934131560000 \lor \neg \left(z \le 2.47177184411059884 \cdot 10^{-52}\right):\\
\;\;\;\;\frac{\left(\frac{1}{2} \cdot \left(e^{-x} + e^{x}\right)\right) \cdot y}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{z}}{x}\\
\end{array}double f(double x, double y, double z) {
double r382938 = x;
double r382939 = cosh(r382938);
double r382940 = y;
double r382941 = r382940 / r382938;
double r382942 = r382939 * r382941;
double r382943 = z;
double r382944 = r382942 / r382943;
return r382944;
}
double f(double x, double y, double z) {
double r382945 = z;
double r382946 = -3.7805197859341316e+21;
bool r382947 = r382945 <= r382946;
double r382948 = 2.471771844110599e-52;
bool r382949 = r382945 <= r382948;
double r382950 = !r382949;
bool r382951 = r382947 || r382950;
double r382952 = 0.5;
double r382953 = x;
double r382954 = -r382953;
double r382955 = exp(r382954);
double r382956 = exp(r382953);
double r382957 = r382955 + r382956;
double r382958 = r382952 * r382957;
double r382959 = y;
double r382960 = r382958 * r382959;
double r382961 = r382945 * r382953;
double r382962 = r382960 / r382961;
double r382963 = cosh(r382953);
double r382964 = r382963 * r382959;
double r382965 = r382964 / r382945;
double r382966 = r382965 / r382953;
double r382967 = r382951 ? r382962 : r382966;
return r382967;
}




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.7805197859341316e+21 or 2.471771844110599e-52 < z Initial program 11.0
rmApplied associate-*r/11.0
Applied associate-/l/0.4
rmApplied clear-num0.8
rmApplied *-un-lft-identity0.8
Applied add-cube-cbrt0.8
Applied times-frac0.8
Simplified0.8
Simplified10.1
Taylor expanded around inf 0.4
Simplified0.4
if -3.7805197859341316e+21 < z < 2.471771844110599e-52Initial program 0.4
rmApplied associate-*r/0.4
Applied associate-/l/20.7
rmApplied associate-/r*0.3
Final simplification0.4
herbie shell --seed 2019198 +o rules:numerics
(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))