\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;y \leq -4.651198953700106 \cdot 10^{+87}:\\
\;\;\;\;\cosh x \cdot \left(y \cdot \frac{1}{x \cdot z}\right)\\
\mathbf{elif}\;y \leq 6.083274916861838 \cdot 10^{-33}:\\
\;\;\;\;\frac{0.5 \cdot \frac{y \cdot \left(e^{x} + e^{-x}\right)}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x \cdot \frac{y}{z}}{x}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
(FPCore (x y z)
:precision binary64
(if (<= y -4.651198953700106e+87)
(* (cosh x) (* y (/ 1.0 (* x z))))
(if (<= y 6.083274916861838e-33)
(/ (* 0.5 (/ (* y (+ (exp x) (exp (- x)))) x)) z)
(/ (* (cosh x) (/ 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 (y <= -4.651198953700106e+87) {
tmp = cosh(x) * (y * (1.0 / (x * z)));
} else if (y <= 6.083274916861838e-33) {
tmp = (0.5 * ((y * (exp(x) + exp(-x))) / x)) / z;
} else {
tmp = (cosh(x) * (y / z)) / x;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.6 |
|---|---|
| Target | 0.5 |
| Herbie | 0.7 |
if y < -4.65119895370010597e87Initial program 28.7
rmApplied *-un-lft-identity_binary6428.7
Applied times-frac_binary6428.7
Simplified28.7
Simplified0.3
rmApplied div-inv_binary640.4
if -4.65119895370010597e87 < y < 6.0832749168618383e-33Initial program 0.8
Taylor expanded around inf 0.9
if 6.0832749168618383e-33 < y Initial program 18.9
rmApplied *-un-lft-identity_binary6418.9
Applied times-frac_binary6418.8
Simplified18.8
Simplified0.5
rmApplied *-un-lft-identity_binary640.5
Applied times-frac_binary640.5
Applied associate-*r*_binary640.5
Simplified0.5
rmApplied associate-*l/_binary640.4
Final simplification0.7
herbie shell --seed 2021155
(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.0385305359351529e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))