\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;\cosh x \cdot \frac{y}{x} \leq -5.8237894250236384 \cdot 10^{+256} \lor \neg \left(\cosh x \cdot \frac{y}{x} \leq 7.777588006988912 \cdot 10^{+175}\right):\\
\;\;\;\;\frac{\frac{y \cdot \left(e^{x} + e^{-x}\right)}{z}}{x \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\left(\cosh x \cdot \frac{y}{x}\right) \cdot \frac{1}{z}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
(FPCore (x y z)
:precision binary64
(if (or (<= (* (cosh x) (/ y x)) -5.8237894250236384e+256)
(not (<= (* (cosh x) (/ y x)) 7.777588006988912e+175)))
(/ (/ (* y (+ (exp x) (exp (- x)))) z) (* x 2.0))
(* (* (cosh x) (/ y x)) (/ 1.0 z))))double code(double x, double y, double z) {
return (((double) (((double) cosh(x)) * (y / x))) / z);
}
double code(double x, double y, double z) {
double tmp;
if (((((double) (((double) cosh(x)) * (y / x))) <= -5.8237894250236384e+256) || !(((double) (((double) cosh(x)) * (y / x))) <= 7.777588006988912e+175))) {
tmp = ((((double) (y * ((double) (((double) exp(x)) + ((double) exp(((double) -(x)))))))) / z) / ((double) (x * 2.0)));
} else {
tmp = ((double) (((double) (((double) cosh(x)) * (y / x))) * (1.0 / z)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.6 |
|---|---|
| Target | 0.4 |
| Herbie | 0.5 |
if (*.f64 (cosh.f64 x) (/.f64 y x)) < -5.82378942502363837e256 or 7.77758800698891167e175 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 30.9
rmApplied cosh-def_binary6430.9
Applied frac-times_binary6430.9
Applied associate-/l/_binary641.1
Simplified1.1
rmApplied add-sqr-sqrt_binary642.0
Applied associate-*l*_binary641.7
Simplified1.7
rmApplied associate-/r*_binary641.7
Simplified1.1
if -5.82378942502363837e256 < (*.f64 (cosh.f64 x) (/.f64 y x)) < 7.77758800698891167e175Initial program 0.2
rmApplied div-inv_binary640.3
Final simplification0.5
herbie shell --seed 2020205
(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))