\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;\cosh x \cdot \frac{y}{x} = -inf.0 \lor \neg \left(\cosh x \cdot \frac{y}{x} \le 3.7080047232710205 \cdot 10^{110}\right):\\
\;\;\;\;\frac{1}{2} \cdot \frac{x \cdot y}{z} + \frac{y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x \cdot \frac{y}{x}}{z}\\
\end{array}double code(double x, double y, double z) {
return ((double) (((double) (((double) cosh(x)) * ((double) (y / x)))) / z));
}
double code(double x, double y, double z) {
double VAR;
if (((((double) (((double) cosh(x)) * ((double) (y / x)))) <= -inf.0) || !(((double) (((double) cosh(x)) * ((double) (y / x)))) <= 3.7080047232710205e+110))) {
VAR = ((double) (((double) (0.5 * ((double) (((double) (x * y)) / z)))) + ((double) (y / ((double) (x * z))))));
} else {
VAR = ((double) (((double) (((double) cosh(x)) * ((double) (y / x)))) / z));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.7 |
|---|---|
| Target | 0.4 |
| Herbie | 0.8 |
if (* (cosh x) (/ y x)) < -inf.0 or 3.7080047232710205e110 < (* (cosh x) (/ y x)) Initial program 29.2
Taylor expanded around 0 2.4
if -inf.0 < (* (cosh x) (/ y x)) < 3.7080047232710205e110Initial program 0.2
Final simplification0.8
herbie shell --seed 2020150
(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))