\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;\cosh x \cdot \frac{y}{x} \le -5.2383203256810599 \cdot 10^{302}:\\
\;\;\;\;\frac{\cosh x}{\frac{z \cdot x}{y}}\\
\mathbf{elif}\;\cosh x \cdot \frac{y}{x} \le 6.08538018889700869 \cdot 10^{170}:\\
\;\;\;\;\frac{\cosh x \cdot \frac{y}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{z}}{x}\\
\end{array}double f(double x, double y, double z) {
double r479451 = x;
double r479452 = cosh(r479451);
double r479453 = y;
double r479454 = r479453 / r479451;
double r479455 = r479452 * r479454;
double r479456 = z;
double r479457 = r479455 / r479456;
return r479457;
}
double f(double x, double y, double z) {
double r479458 = x;
double r479459 = cosh(r479458);
double r479460 = y;
double r479461 = r479460 / r479458;
double r479462 = r479459 * r479461;
double r479463 = -5.23832032568106e+302;
bool r479464 = r479462 <= r479463;
double r479465 = z;
double r479466 = r479465 * r479458;
double r479467 = r479466 / r479460;
double r479468 = r479459 / r479467;
double r479469 = 6.085380188897009e+170;
bool r479470 = r479462 <= r479469;
double r479471 = r479462 / r479465;
double r479472 = r479459 * r479460;
double r479473 = r479472 / r479465;
double r479474 = r479473 / r479458;
double r479475 = r479470 ? r479471 : r479474;
double r479476 = r479464 ? r479468 : r479475;
return r479476;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 8.0 |
|---|---|
| Target | 0.5 |
| Herbie | 0.4 |
if (* (cosh x) (/ y x)) < -5.23832032568106e+302Initial program 61.0
rmApplied associate-*r/61.0
Applied associate-/l/0.7
rmApplied associate-/l*0.8
if -5.23832032568106e+302 < (* (cosh x) (/ y x)) < 6.085380188897009e+170Initial program 0.3
if 6.085380188897009e+170 < (* (cosh x) (/ y x)) Initial program 24.2
rmApplied associate-*r/24.2
Applied associate-/l/1.5
rmApplied associate-/r*1.1
Final simplification0.4
herbie shell --seed 2020033 +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))