\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;\cosh x \cdot \frac{y}{x} \leq -3.927886336883088 \cdot 10^{+282}:\\
\;\;\;\;\left(\cosh x \cdot y\right) \cdot \frac{1}{x \cdot z}\\
\mathbf{elif}\;\cosh x \cdot \frac{y}{x} \leq 1.1771731479509362 \cdot 10^{+257}:\\
\;\;\;\;\frac{\cosh x \cdot \frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x \cdot y}{x \cdot z}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
(FPCore (x y z)
:precision binary64
(if (<= (* (cosh x) (/ y x)) -3.927886336883088e+282)
(* (* (cosh x) y) (/ 1.0 (* x z)))
(if (<= (* (cosh x) (/ y x)) 1.1771731479509362e+257)
(/ (* (cosh x) (/ y x)) z)
(/ (* (cosh x) y) (* x z)))))double code(double x, double y, double z) {
return (cosh(x) * (y / x)) / z;
}
double code(double x, double y, double z) {
double tmp;
if ((cosh(x) * (y / x)) <= -3.927886336883088e+282) {
tmp = (cosh(x) * y) * (1.0 / (x * z));
} else if ((cosh(x) * (y / x)) <= 1.1771731479509362e+257) {
tmp = (cosh(x) * (y / x)) / z;
} else {
tmp = (cosh(x) * y) / (x * z);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.7 |
|---|---|
| Target | 0.4 |
| Herbie | 0.3 |
if (*.f64 (cosh.f64 x) (/.f64 y x)) < -3.927886336883088e282Initial program 51.1
rmApplied *-un-lft-identity_binary64_1133151.1
Applied times-frac_binary64_1133751.0
Simplified51.0
Simplified0.6
rmApplied div-inv_binary64_113280.7
Applied associate-*r*_binary64_112710.8
Simplified0.8
if -3.927886336883088e282 < (*.f64 (cosh.f64 x) (/.f64 y x)) < 1.1771731479509362e257Initial program 0.2
if 1.1771731479509362e257 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 42.5
rmApplied associate-*r/_binary64_1127342.5
Applied associate-/l/_binary64_112780.5
Final simplification0.3
herbie shell --seed 2021098
(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))