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




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 8.0 |
|---|---|
| Target | 0.5 |
| Herbie | 0.7 |
if y < -3.44185133332383086e-84Initial program 15.4
Taylor expanded in x around inf 15.4
Applied *-un-lft-identity_binary6415.4
Applied *-un-lft-identity_binary6415.4
Applied distribute-lft-out_binary6415.4
Applied times-frac_binary6415.4
Applied times-frac_binary6415.4
Simplified15.4
Simplified1.5
if -3.44185133332383086e-84 < y < 5.15242417461317167e47Initial program 0.5
Applied cosh-def_binary640.5
Applied frac-times_binary640.5
Simplified0.5
Simplified0.5
if 5.15242417461317167e47 < y Initial program 26.5
Applied associate-*r/_binary6426.5
Applied associate-/l/_binary640.3
Final simplification0.7
herbie shell --seed 2022088
(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))