\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;\cosh x \cdot \frac{y}{x} \leq -2.2399278934765164 \cdot 10^{+259}:\\
\;\;\;\;\frac{\frac{\cosh x}{\frac{z}{y}}}{x}\\
\mathbf{elif}\;\cosh x \cdot \frac{y}{x} \leq 9.327621303551723 \cdot 10^{+238}:\\
\;\;\;\;\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)) -2.2399278934765164e+259)
(/ (/ (cosh x) (/ z y)) x)
(if (<= (* (cosh x) (/ y x)) 9.327621303551723e+238)
(/ (* (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)) <= -2.2399278934765164e+259) {
tmp = (cosh(x) / (z / y)) / x;
} else if ((cosh(x) * (y / x)) <= 9.327621303551723e+238) {
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.5 |
|---|---|
| Target | 0.4 |
| Herbie | 0.3 |
if (*.f64 (cosh.f64 x) (/.f64 y x)) < -2.2399278934765164e259Initial program 40.2
rmApplied div-inv_binary6440.3
rmApplied associate-*r/_binary6440.3
Applied associate-*l/_binary640.7
Simplified0.6
rmApplied associate-/l*_binary640.5
if -2.2399278934765164e259 < (*.f64 (cosh.f64 x) (/.f64 y x)) < 9.3276213035517234e238Initial program 0.2
if 9.3276213035517234e238 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 36.8
rmApplied associate-*r/_binary6436.8
Applied associate-/l/_binary640.6
Simplified0.6
Final simplification0.3
herbie shell --seed 2020231
(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))