\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;\frac{\cosh x \cdot \frac{y}{x}}{z} \leq -6.594132343947064 \cdot 10^{+229}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{\cosh x}{x}\\
\mathbf{elif}\;\frac{\cosh x \cdot \frac{y}{x}}{z} \leq 1.1306874589075905 \cdot 10^{+300}:\\
\;\;\;\;\frac{\cosh x \cdot \frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{z} + \frac{y}{x \cdot z}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
(FPCore (x y z)
:precision binary64
(if (<= (/ (* (cosh x) (/ y x)) z) -6.594132343947064e+229)
(* (/ y z) (/ (cosh x) x))
(if (<= (/ (* (cosh x) (/ y x)) z) 1.1306874589075905e+300)
(/ (* (cosh x) (/ y x)) z)
(+ (* 0.5 (/ (* x y) z)) (/ 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) <= -6.594132343947064e+229) {
tmp = (y / z) * (cosh(x) / x);
} else if (((cosh(x) * (y / x)) / z) <= 1.1306874589075905e+300) {
tmp = (cosh(x) * (y / x)) / z;
} else {
tmp = (0.5 * ((x * y) / z)) + (y / (x * z));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.8 |
|---|---|
| Target | 0.4 |
| Herbie | 0.5 |
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < -6.5941323439470641e229Initial program 34.7
rmApplied associate-/l*_binary64_1400434.5
rmApplied associate-/r/_binary64_140050.4
Applied *-un-lft-identity_binary64_140590.4
Applied times-frac_binary64_140650.5
Simplified0.4
if -6.5941323439470641e229 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 1.13068745890759053e300Initial program 0.3
if 1.13068745890759053e300 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 59.5
Taylor expanded around 0 3.1
Final simplification0.5
herbie shell --seed 2021043
(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))