\frac{\cosh x \cdot \frac{y}{x}}{z}
\begin{array}{l}
\mathbf{if}\;x \leq 2.71211154208478 \cdot 10^{-288} \lor \neg \left(x \leq 7.30782984999272 \cdot 10^{-25}\right):\\
\;\;\;\;\frac{0.5 \cdot \frac{y \cdot \left(e^{x} + \frac{1}{e^{x}}\right)}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \frac{\cosh x}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\right) \cdot \frac{\frac{1}{x}}{\sqrt[3]{z}}\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
(FPCore (x y z) :precision binary64 (if (or (<= x 2.71211154208478e-288) (not (<= x 7.30782984999272e-25))) (/ (* 0.5 (/ (* y (+ (exp x) (/ 1.0 (exp x)))) x)) z) (* (* y (/ (cosh x) (* (cbrt z) (cbrt z)))) (/ (/ 1.0 x) (cbrt z)))))
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 ((x <= 2.71211154208478e-288) || !(x <= 7.30782984999272e-25)) {
tmp = (0.5 * ((y * (exp(x) + (1.0 / exp(x)))) / x)) / z;
} else {
tmp = (y * (cosh(x) / (cbrt(z) * cbrt(z)))) * ((1.0 / x) / cbrt(z));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 9.8 |
|---|---|
| Target | 1.8 |
| Herbie | 2.2 |
if x < 2.71211154208477987e-288 or 7.3078298499927198e-25 < x Initial program 10.8
Taylor expanded in y around inf 1.7
if 2.71211154208477987e-288 < x < 7.3078298499927198e-25Initial program 5.9
Applied associate-*r/_binary645.9
Applied add-cube-cbrt_binary646.6
Applied div-inv_binary646.6
Applied times-frac_binary644.3
Simplified4.3
Final simplification2.2
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))