\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;y \le -1.570530855841579352725070352970716566831 \cdot 10^{-31} \lor \neg \left(y \le 1.168432178035094477207947711711724571865 \cdot 10^{-120}\right):\\
\;\;\;\;\frac{\cosh x \cdot y}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\cosh x \cdot \frac{\frac{y}{x}}{z}\\
\end{array}double f(double x, double y, double z) {
double r355113 = x;
double r355114 = cosh(r355113);
double r355115 = y;
double r355116 = r355115 / r355113;
double r355117 = r355114 * r355116;
double r355118 = z;
double r355119 = r355117 / r355118;
return r355119;
}
double f(double x, double y, double z) {
double r355120 = y;
double r355121 = -1.5705308558415794e-31;
bool r355122 = r355120 <= r355121;
double r355123 = 1.1684321780350945e-120;
bool r355124 = r355120 <= r355123;
double r355125 = !r355124;
bool r355126 = r355122 || r355125;
double r355127 = x;
double r355128 = cosh(r355127);
double r355129 = r355128 * r355120;
double r355130 = z;
double r355131 = r355130 * r355127;
double r355132 = r355129 / r355131;
double r355133 = r355120 / r355127;
double r355134 = r355133 / r355130;
double r355135 = r355128 * r355134;
double r355136 = r355126 ? r355132 : r355135;
return r355136;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.6 |
|---|---|
| Target | 0.4 |
| Herbie | 1.0 |
if y < -1.5705308558415794e-31 or 1.1684321780350945e-120 < y Initial program 15.1
rmApplied associate-*r/15.1
Applied associate-/l/1.6
if -1.5705308558415794e-31 < y < 1.1684321780350945e-120Initial program 0.3
rmApplied *-un-lft-identity0.3
Applied times-frac0.3
Simplified0.3
Final simplification1.0
herbie shell --seed 2019347 +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))