\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -5.90737577331802458 \cdot 10^{-57} \lor \neg \left(z \le 2.54423027784147743 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{\cosh x \cdot y}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{x \cdot \frac{z}{y}}\\
\end{array}double f(double x, double y, double z) {
double r507111 = x;
double r507112 = cosh(r507111);
double r507113 = y;
double r507114 = r507113 / r507111;
double r507115 = r507112 * r507114;
double r507116 = z;
double r507117 = r507115 / r507116;
return r507117;
}
double f(double x, double y, double z) {
double r507118 = z;
double r507119 = -5.907375773318025e-57;
bool r507120 = r507118 <= r507119;
double r507121 = 2.5442302778414774e-06;
bool r507122 = r507118 <= r507121;
double r507123 = !r507122;
bool r507124 = r507120 || r507123;
double r507125 = x;
double r507126 = cosh(r507125);
double r507127 = y;
double r507128 = r507126 * r507127;
double r507129 = r507125 * r507118;
double r507130 = r507128 / r507129;
double r507131 = r507118 / r507127;
double r507132 = r507125 * r507131;
double r507133 = r507126 / r507132;
double r507134 = r507124 ? r507130 : r507133;
return r507134;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.6 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
if z < -5.907375773318025e-57 or 2.5442302778414774e-06 < z Initial program 10.7
rmApplied associate-*r/10.7
Applied associate-/l/0.4
Simplified0.4
if -5.907375773318025e-57 < z < 2.5442302778414774e-06Initial program 0.3
rmApplied associate-/l*0.4
Simplified0.4
Taylor expanded around 0 21.9
Simplified0.3
Final simplification0.4
herbie shell --seed 2020045 +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))