\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;y \le -184150434362061826180164289036288 \lor \neg \left(y \le 3325101390191379852297270305226752\right):\\
\;\;\;\;\frac{\frac{\cosh x \cdot y}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(e^{x} + e^{-x}\right) \cdot \frac{y}{x}}{z \cdot 2}\\
\end{array}double f(double x, double y, double z) {
double r321188 = x;
double r321189 = cosh(r321188);
double r321190 = y;
double r321191 = r321190 / r321188;
double r321192 = r321189 * r321191;
double r321193 = z;
double r321194 = r321192 / r321193;
return r321194;
}
double f(double x, double y, double z) {
double r321195 = y;
double r321196 = -1.8415043436206183e+32;
bool r321197 = r321195 <= r321196;
double r321198 = 3.32510139019138e+33;
bool r321199 = r321195 <= r321198;
double r321200 = !r321199;
bool r321201 = r321197 || r321200;
double r321202 = x;
double r321203 = cosh(r321202);
double r321204 = r321203 * r321195;
double r321205 = z;
double r321206 = r321204 / r321205;
double r321207 = r321206 / r321202;
double r321208 = exp(r321202);
double r321209 = -r321202;
double r321210 = exp(r321209);
double r321211 = r321208 + r321210;
double r321212 = r321195 / r321202;
double r321213 = r321211 * r321212;
double r321214 = 2.0;
double r321215 = r321205 * r321214;
double r321216 = r321213 / r321215;
double r321217 = r321201 ? r321207 : r321216;
return r321217;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.7 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
if y < -1.8415043436206183e+32 or 3.32510139019138e+33 < y Initial program 24.5
rmApplied associate-*r/24.5
Applied associate-/l/0.4
rmApplied associate-/r*0.4
if -1.8415043436206183e+32 < y < 3.32510139019138e+33Initial program 0.4
rmApplied cosh-def0.4
Applied associate-*l/0.4
Applied associate-/l/0.4
Final simplification0.4
herbie shell --seed 2019306
(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))