\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;\frac{\cosh x \cdot \frac{y}{x}}{z} \leq -5193.795431700195 \lor \neg \left(\frac{\cosh x \cdot \frac{y}{x}}{z} \leq 2.3817947252374567 \cdot 10^{+33}\right):\\
\;\;\;\;\frac{\frac{y \cdot \left(e^{x} + e^{-x}\right)}{z}}{x \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x \cdot y}{x \cdot 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)) z) -5193.795431700195)
(not (<= (/ (* (cosh x) (/ y x)) z) 2.3817947252374567e+33)))
(/ (/ (* y (+ (exp x) (exp (- x)))) z) (* x 2.0))
(/ (* (cosh x) y) (* 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 tmp;
if ((((cosh(x) * (y / x)) / z) <= -5193.795431700195) || !(((cosh(x) * (y / x)) / z) <= 2.3817947252374567e+33)) {
tmp = ((y * (exp(x) + exp(-x))) / z) / (x * 2.0);
} else {
tmp = (cosh(x) * y) / (x * z);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.4 |
|---|---|
| Target | 0.4 |
| Herbie | 0.3 |
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < -5193.795431700195 or 2.3817947252374567e33 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 13.2
rmApplied div-inv_binary6413.2
rmApplied cosh-def_binary6413.2
Applied frac-times_binary6413.2
Applied associate-*l/_binary640.5
Simplified0.4
if -5193.795431700195 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 2.3817947252374567e33Initial program 0.2
rmApplied associate-*r/_binary640.2
Applied associate-/l/_binary640.3
Simplified0.3
Final simplification0.3
herbie shell --seed 2020232
(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))