\frac{\cosh x \cdot \frac{y}{x}}{z}
\begin{array}{l}
\mathbf{if}\;z \leq -3.443166066450671 \cdot 10^{+34}:\\
\;\;\;\;\frac{0.5 \cdot \left(e^{x} \cdot y\right) + 0.5 \cdot \left(y \cdot e^{-x}\right)}{z \cdot x}\\
\mathbf{elif}\;z \leq 3.30371938788329 \cdot 10^{+39}:\\
\;\;\;\;\frac{\frac{y}{z} \cdot \mathsf{fma}\left(0.5, e^{x}, \frac{0.5}{e^{x}}\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.001388888888888889, \frac{y \cdot {x}^{5}}{z}, \mathsf{fma}\left(0.5, \frac{x \cdot y}{z}, \mathsf{fma}\left(0.041666666666666664, \frac{y \cdot {x}^{3}}{z}, \frac{y}{z \cdot x}\right)\right)\right)\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
(FPCore (x y z)
:precision binary64
(if (<= z -3.443166066450671e+34)
(/ (+ (* 0.5 (* (exp x) y)) (* 0.5 (* y (exp (- x))))) (* z x))
(if (<= z 3.30371938788329e+39)
(/ (* (/ y z) (fma 0.5 (exp x) (/ 0.5 (exp x)))) x)
(fma
0.001388888888888889
(/ (* y (pow x 5.0)) z)
(fma
0.5
(/ (* x y) z)
(fma 0.041666666666666664 (/ (* y (pow x 3.0)) z) (/ y (* 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 <= -3.443166066450671e+34) {
tmp = ((0.5 * (exp(x) * y)) + (0.5 * (y * exp(-x)))) / (z * x);
} else if (z <= 3.30371938788329e+39) {
tmp = ((y / z) * fma(0.5, exp(x), (0.5 / exp(x)))) / x;
} else {
tmp = fma(0.001388888888888889, ((y * pow(x, 5.0)) / z), fma(0.5, ((x * y) / z), fma(0.041666666666666664, ((y * pow(x, 3.0)) / z), (y / (z * x)))));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 7.9 |
|---|---|
| Target | 0.5 |
| Herbie | 0.6 |
if z < -3.4431660664506708e34Initial program 12.9
Taylor expanded in x around inf 0.3
Applied div-inv_binary640.3
Simplified0.3
if -3.4431660664506708e34 < z < 3.30371938788329005e39Initial program 0.6
Taylor expanded in x around inf 16.0
Applied associate-/r*_binary640.6
Taylor expanded in x around -inf 0.6
Simplified0.6
if 3.30371938788329005e39 < z Initial program 13.5
Taylor expanded in x around 0 0.8
Simplified0.8
Final simplification0.6
herbie shell --seed 2022077
(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))