\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -2.5383590026819785 \cdot 10^{-19}:\\
\;\;\;\;\cosh x \cdot \frac{y}{x \cdot z}\\
\mathbf{elif}\;z \le 2.0632746827096628 \cdot 10^{22}:\\
\;\;\;\;\frac{\frac{y}{z} \cdot \mathsf{fma}\left(e^{x}, \frac{1}{2}, \frac{\frac{1}{2}}{e^{x}}\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\cosh x \cdot y\right) \cdot \frac{\frac{1}{x}}{z}\\
\end{array}double code(double x, double y, double z) {
return ((cosh(x) * (y / x)) / z);
}
double code(double x, double y, double z) {
double temp;
if ((z <= -2.5383590026819785e-19)) {
temp = (cosh(x) * (y / (x * z)));
} else {
double temp_1;
if ((z <= 2.0632746827096628e+22)) {
temp_1 = (((y / z) * fma(exp(x), 0.5, (0.5 / exp(x)))) / x);
} else {
temp_1 = ((cosh(x) * y) * ((1.0 / x) / z));
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.8 |
|---|---|
| Target | 0.4 |
| Herbie | 0.3 |
if z < -2.5383590026819785e-19Initial program 11.1
rmApplied *-un-lft-identity11.1
Applied times-frac11.1
Simplified11.1
Simplified0.3
if -2.5383590026819785e-19 < z < 2.0632746827096628e+22Initial program 0.3
rmApplied *-un-lft-identity0.3
Applied times-frac0.3
Simplified0.3
Simplified19.1
Taylor expanded around inf 19.1
Simplified0.3
if 2.0632746827096628e+22 < z Initial program 13.1
rmApplied div-inv13.2
Applied associate-*r*13.2
rmApplied *-un-lft-identity13.2
Applied times-frac0.3
Simplified0.3
Final simplification0.3
herbie shell --seed 2020066 +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.0385305359351529e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))