\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -147933744.31255263 \lor \neg \left(z \le 5673807207157.2168\right):\\
\;\;\;\;\cosh x \cdot \left(y \cdot \frac{1}{x \cdot z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z} \cdot \mathsf{fma}\left(e^{x}, \frac{1}{2}, \frac{\frac{1}{2}}{e^{x}}\right)}{x}\\
\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 temp;
if (((z <= -147933744.31255263) || !(z <= 5673807207157.217))) {
temp = (cosh(x) * (y * (1.0 / (x * z))));
} else {
temp = (((y / z) * fma(exp(x), 0.5, (0.5 / exp(x)))) / x);
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.9 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
if z < -147933744.31255263 or 5673807207157.217 < z Initial program 12.5
rmApplied *-un-lft-identity12.5
Applied times-frac12.5
Simplified12.5
Simplified0.3
rmApplied div-inv0.4
if -147933744.31255263 < z < 5673807207157.217Initial program 0.4
rmApplied *-un-lft-identity0.4
Applied times-frac0.4
Simplified0.4
Simplified18.4
Taylor expanded around inf 18.4
Simplified0.3
Final simplification0.4
herbie shell --seed 2020056 +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))