\frac{\cosh x \cdot \frac{y}{x}}{z}
\begin{array}{l}
\mathbf{if}\;z \leq -404248964266.4667:\\
\;\;\;\;\frac{y \cdot \mathsf{fma}\left(0.5, e^{x}, \frac{0.5}{e^{x}}\right)}{z \cdot x}\\
\mathbf{elif}\;z \leq 4.13020256225072 \cdot 10^{+92}:\\
\;\;\;\;\frac{\cosh x \cdot \frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \mathsf{fma}\left(e^{x}, y, \frac{y}{e^{x}}\right)}{z \cdot x}\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
(FPCore (x y z)
:precision binary64
(if (<= z -404248964266.4667)
(/ (* y (fma 0.5 (exp x) (/ 0.5 (exp x)))) (* z x))
(if (<= z 4.13020256225072e+92)
(/ (* (cosh x) (/ y x)) z)
(/ (* 0.5 (fma (exp x) y (/ y (exp x)))) (* z x)))))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 (z <= -404248964266.4667) {
tmp = (y * fma(0.5, exp(x), (0.5 / exp(x)))) / (z * x);
} else if (z <= 4.13020256225072e+92) {
tmp = (cosh(x) * (y / x)) / z;
} else {
tmp = (0.5 * fma(exp(x), y, (y / exp(x)))) / (z * x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 7.6 |
|---|---|
| Target | 0.4 |
| Herbie | 0.7 |
if z < -404248964266.46667Initial program 11.8
Taylor expanded in x around inf 0.3
Taylor expanded in x around -inf 0.3
Simplified0.3
if -404248964266.46667 < z < 4.13020256225072017e92Initial program 1.1
if 4.13020256225072017e92 < z Initial program 14.1
Taylor expanded in x around inf 0.3
Applied egg-rr0.3
Final simplification0.7
herbie shell --seed 2022130
(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.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))