\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -712742474614758 \lor \neg \left(z \le 3.970994457643005255735446389224709150426 \cdot 10^{112}\right):\\
\;\;\;\;\frac{e^{x} + e^{-x}}{z \cdot \left(2 \cdot x\right)} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(e^{x} + e^{-x}\right) \cdot y}{z}}{2 \cdot x}\\
\end{array}double f(double x, double y, double z) {
double r346534 = x;
double r346535 = cosh(r346534);
double r346536 = y;
double r346537 = r346536 / r346534;
double r346538 = r346535 * r346537;
double r346539 = z;
double r346540 = r346538 / r346539;
return r346540;
}
double f(double x, double y, double z) {
double r346541 = z;
double r346542 = -712742474614758.0;
bool r346543 = r346541 <= r346542;
double r346544 = 3.970994457643005e+112;
bool r346545 = r346541 <= r346544;
double r346546 = !r346545;
bool r346547 = r346543 || r346546;
double r346548 = x;
double r346549 = exp(r346548);
double r346550 = -r346548;
double r346551 = exp(r346550);
double r346552 = r346549 + r346551;
double r346553 = 2.0;
double r346554 = r346553 * r346548;
double r346555 = r346541 * r346554;
double r346556 = r346552 / r346555;
double r346557 = y;
double r346558 = r346556 * r346557;
double r346559 = r346552 * r346557;
double r346560 = r346559 / r346541;
double r346561 = r346560 / r346554;
double r346562 = r346547 ? r346558 : r346561;
return r346562;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.8 |
|---|---|
| Target | 0.5 |
| Herbie | 1.0 |
if z < -712742474614758.0 or 3.970994457643005e+112 < z Initial program 13.3
rmApplied cosh-def13.3
Applied frac-times13.3
Applied associate-/l/0.4
rmApplied associate-/l*0.8
rmApplied associate-/r/0.4
if -712742474614758.0 < z < 3.970994457643005e+112Initial program 1.8
rmApplied cosh-def1.8
Applied frac-times1.8
Applied associate-/l/14.0
rmApplied associate-/r*1.6
Final simplification1.0
herbie shell --seed 2019303 +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))