\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -1.66967556320118367307962221628093140978 \cdot 10^{106} \lor \neg \left(z \le 1.580946681139865959507055911418667078904 \cdot 10^{-36}\right):\\
\;\;\;\;\frac{\cosh x \cdot y}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\left(e^{-x} + e^{x}\right) \cdot y}{x}}{2}}{z}\\
\end{array}double f(double x, double y, double z) {
double r302184 = x;
double r302185 = cosh(r302184);
double r302186 = y;
double r302187 = r302186 / r302184;
double r302188 = r302185 * r302187;
double r302189 = z;
double r302190 = r302188 / r302189;
return r302190;
}
double f(double x, double y, double z) {
double r302191 = z;
double r302192 = -1.6696755632011837e+106;
bool r302193 = r302191 <= r302192;
double r302194 = 1.580946681139866e-36;
bool r302195 = r302191 <= r302194;
double r302196 = !r302195;
bool r302197 = r302193 || r302196;
double r302198 = x;
double r302199 = cosh(r302198);
double r302200 = y;
double r302201 = r302199 * r302200;
double r302202 = r302191 * r302198;
double r302203 = r302201 / r302202;
double r302204 = -r302198;
double r302205 = exp(r302204);
double r302206 = exp(r302198);
double r302207 = r302205 + r302206;
double r302208 = r302207 * r302200;
double r302209 = r302208 / r302198;
double r302210 = 2.0;
double r302211 = r302209 / r302210;
double r302212 = r302211 / r302191;
double r302213 = r302197 ? r302203 : r302212;
return r302213;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.7 |
|---|---|
| Target | 0.4 |
| Herbie | 0.8 |
if z < -1.6696755632011837e+106 or 1.580946681139866e-36 < z Initial program 12.3
rmApplied associate-*r/12.3
Applied associate-/l/0.3
if -1.6696755632011837e+106 < z < 1.580946681139866e-36Initial program 1.5
rmApplied div-inv1.6
Applied associate-*r*1.6
rmApplied cosh-def1.6
Applied associate-*l/1.6
Applied associate-*l/1.6
Simplified1.5
Final simplification0.8
herbie shell --seed 2019306 +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.03853053593515302e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))
(/ (* (cosh x) (/ y x)) z))