\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \leq -48252226705934.2 \lor \neg \left(z \leq 1.906593198200087 \cdot 10^{-141}\right):\\
\;\;\;\;\frac{\cosh x \cdot y}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\left(\cosh x \cdot \frac{y}{x}\right) \cdot \frac{1}{z}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
(FPCore (x y z) :precision binary64 (if (or (<= z -48252226705934.2) (not (<= z 1.906593198200087e-141))) (/ (* (cosh x) y) (* z x)) (* (* (cosh x) (/ y x)) (/ 1.0 z))))
double code(double x, double y, double z) {
return (((double) (((double) cosh(x)) * (y / x))) / z);
}
double code(double x, double y, double z) {
double tmp;
if (((z <= -48252226705934.2) || !(z <= 1.906593198200087e-141))) {
tmp = (((double) (((double) cosh(x)) * y)) / ((double) (z * x)));
} else {
tmp = ((double) (((double) (((double) cosh(x)) * (y / x))) * (1.0 / z)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.4 |
|---|---|
| Target | 0.4 |
| Herbie | 1.3 |
if z < -48252226705934.203 or 1.90659319820008714e-141 < z Initial program 10.0
rmApplied associate-*r/_binary6410.0
Applied associate-/l/_binary641.7
Simplified1.7
if -48252226705934.203 < z < 1.90659319820008714e-141Initial program 0.3
rmApplied div-inv_binary640.3
Final simplification1.3
herbie shell --seed 2020210
(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))