\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -1.40953097935408513 \cdot 10^{35} \lor \neg \left(z \le 5.82511916007843312 \cdot 10^{-85}\right):\\
\;\;\;\;\frac{\cosh x \cdot y}{x \cdot z}\\
\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 r529933 = x;
double r529934 = cosh(r529933);
double r529935 = y;
double r529936 = r529935 / r529933;
double r529937 = r529934 * r529936;
double r529938 = z;
double r529939 = r529937 / r529938;
return r529939;
}
double f(double x, double y, double z) {
double r529940 = z;
double r529941 = -1.4095309793540851e+35;
bool r529942 = r529940 <= r529941;
double r529943 = 5.825119160078433e-85;
bool r529944 = r529940 <= r529943;
double r529945 = !r529944;
bool r529946 = r529942 || r529945;
double r529947 = x;
double r529948 = cosh(r529947);
double r529949 = y;
double r529950 = r529948 * r529949;
double r529951 = r529947 * r529940;
double r529952 = r529950 / r529951;
double r529953 = exp(r529947);
double r529954 = -r529947;
double r529955 = exp(r529954);
double r529956 = r529953 + r529955;
double r529957 = r529956 * r529949;
double r529958 = r529957 / r529940;
double r529959 = 2.0;
double r529960 = r529959 * r529947;
double r529961 = r529958 / r529960;
double r529962 = r529946 ? r529952 : r529961;
return r529962;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.7 |
|---|---|
| Target | 0.4 |
| Herbie | 0.6 |
if z < -1.4095309793540851e+35 or 5.825119160078433e-85 < z Initial program 11.2
rmApplied div-inv11.2
rmApplied associate-*r/11.2
Applied frac-times0.7
Simplified0.7
if -1.4095309793540851e+35 < z < 5.825119160078433e-85Initial program 0.7
rmApplied div-inv0.8
rmApplied cosh-def0.8
Applied frac-times0.8
Applied associate-*l/0.5
Simplified0.4
Final simplification0.6
herbie shell --seed 2020047
(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.0385305359351529e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))