\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;y \le -8.70083882387234965 \cdot 10^{-14}:\\
\;\;\;\;\frac{1}{2} \cdot \frac{x \cdot y}{z} + \frac{y}{x \cdot z}\\
\mathbf{elif}\;y \le 2.84159300253995619 \cdot 10^{-56}:\\
\;\;\;\;\frac{\frac{\frac{1}{2} \cdot \left(e^{-1 \cdot x} + e^{x}\right)}{\frac{x}{y}}}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(\cosh x \cdot y\right) \cdot \frac{\frac{1}{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 ((y <= -8.70083882387235e-14)) {
VAR = ((double) (((double) (0.5 * ((double) (((double) (x * y)) / z)))) + ((double) (y / ((double) (x * z))))));
} else {
double VAR_1;
if ((y <= 2.841593002539956e-56)) {
VAR_1 = ((double) (((double) (((double) (0.5 * ((double) (((double) exp(((double) (-1.0 * x)))) + ((double) exp(x)))))) / ((double) (x / y)))) / z));
} else {
VAR_1 = ((double) (((double) (((double) cosh(x)) * y)) * ((double) (((double) (1.0 / x)) / z))));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.6 |
|---|---|
| Target | 0.5 |
| Herbie | 0.8 |
if y < -8.70083882387235e-14Initial program 22.1
Taylor expanded around 0 1.4
if -8.70083882387235e-14 < y < 2.841593002539956e-56Initial program 0.3
Taylor expanded around inf 0.3
Simplified0.4
if 2.841593002539956e-56 < y Initial program 14.7
rmApplied div-inv14.8
Applied associate-*r*14.8
rmApplied *-un-lft-identity14.8
Applied times-frac1.2
Simplified1.2
Final simplification0.8
herbie shell --seed 2020122
(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))