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




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 7.7 |
|---|---|
| Target | 0.5 |
| Herbie | 0.6 |
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < -4.3175020757824464e210Initial program 30.6
Taylor expanded in x around inf 14.7
Applied associate-/r*_binary640.5
Applied clear-num_binary640.6
Simplified0.6
if -4.3175020757824464e210 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 2.3836052247519729e-78Initial program 0.2
Applied cosh-def_binary640.2
Applied frac-times_binary640.2
Simplified0.2
Simplified0.2
if 2.3836052247519729e-78 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 10.2
Taylor expanded in x around inf 9.5
Applied associate-/r*_binary641.1
Applied frac-2neg_binary641.1
Simplified1.1
Final simplification0.6
herbie shell --seed 2022081
(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))