\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;z \le -3.16932822131559739 \cdot 10^{-24} \lor \neg \left(z \le 2.23999075420357997 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{e^{\log \left(\cosh x\right)} \cdot y}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\left(\cosh x \cdot \frac{y}{x}\right) \cdot \frac{1}{z}\\
\end{array}double f(double x, double y, double z) {
double r538007 = x;
double r538008 = cosh(r538007);
double r538009 = y;
double r538010 = r538009 / r538007;
double r538011 = r538008 * r538010;
double r538012 = z;
double r538013 = r538011 / r538012;
return r538013;
}
double f(double x, double y, double z) {
double r538014 = z;
double r538015 = -3.1693282213155974e-24;
bool r538016 = r538014 <= r538015;
double r538017 = 2.23999075420358e-19;
bool r538018 = r538014 <= r538017;
double r538019 = !r538018;
bool r538020 = r538016 || r538019;
double r538021 = x;
double r538022 = cosh(r538021);
double r538023 = log(r538022);
double r538024 = exp(r538023);
double r538025 = y;
double r538026 = r538024 * r538025;
double r538027 = r538014 * r538021;
double r538028 = r538026 / r538027;
double r538029 = r538025 / r538021;
double r538030 = r538022 * r538029;
double r538031 = 1.0;
double r538032 = r538031 / r538014;
double r538033 = r538030 * r538032;
double r538034 = r538020 ? r538028 : r538033;
return r538034;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.5 |
|---|---|
| Target | 0.4 |
| Herbie | 0.3 |
if z < -3.1693282213155974e-24 or 2.23999075420358e-19 < z Initial program 11.0
rmApplied associate-*r/11.0
Applied associate-/l/0.3
rmApplied add-exp-log0.3
if -3.1693282213155974e-24 < z < 2.23999075420358e-19Initial program 0.3
rmApplied div-inv0.4
Final simplification0.3
herbie shell --seed 2020034
(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))