\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;y \le -1066615151038.62585:\\
\;\;\;\;\frac{\cosh x \cdot \left(-y\right)}{z \cdot \left(-x\right)}\\
\mathbf{elif}\;y \le 2.7108396115711274 \cdot 10^{26}:\\
\;\;\;\;\frac{\frac{y}{x}}{\frac{z}{\cosh x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x}{\frac{y \cdot \cosh x}{z}}}\\
\end{array}double code(double x, double y, double z) {
return ((cosh(x) * (y / x)) / z);
}
double code(double x, double y, double z) {
double VAR;
if ((y <= -1066615151038.6259)) {
VAR = ((cosh(x) * -y) / (z * -x));
} else {
double VAR_1;
if ((y <= 2.7108396115711274e+26)) {
VAR_1 = ((y / x) / (z / cosh(x)));
} else {
VAR_1 = (1.0 / (x / ((y * cosh(x)) / z)));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.8 |
|---|---|
| Target | 0.5 |
| Herbie | 0.4 |
if y < -1066615151038.6259Initial program 22.7
rmApplied frac-2neg22.7
Applied associate-*r/22.7
Applied associate-/l/0.3
if -1066615151038.6259 < y < 2.7108396115711274e+26Initial program 0.4
rmApplied frac-2neg0.4
Applied associate-*r/0.4
Applied associate-/l/9.8
rmApplied clear-num10.1
Simplified9.9
rmApplied *-commutative9.9
rmApplied associate-/l*9.9
Applied associate-/r/0.7
Applied associate-/r*0.5
Simplified0.4
if 2.7108396115711274e+26 < y Initial program 25.6
rmApplied frac-2neg25.6
Applied associate-*r/25.6
Applied associate-/l/0.3
rmApplied clear-num0.4
Simplified0.3
rmApplied *-commutative0.3
Final simplification0.4
herbie shell --seed 2020078 +o rules:numerics
(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))