\frac{\cosh x \cdot \frac{y}{x}}{z}\begin{array}{l}
\mathbf{if}\;y \le -5.71438945780871019 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{\frac{1}{2} \cdot \left(e^{-1 \cdot x} + e^{x}\right)}{z}}{x} \cdot y\\
\mathbf{elif}\;y \le 2.3191721167167056 \cdot 10^{-29}:\\
\;\;\;\;\left(\cosh x \cdot \frac{y}{x}\right) \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{x} \cdot \frac{y}{z}\\
\end{array}double f(double x, double y, double z) {
double r573724 = x;
double r573725 = cosh(r573724);
double r573726 = y;
double r573727 = r573726 / r573724;
double r573728 = r573725 * r573727;
double r573729 = z;
double r573730 = r573728 / r573729;
return r573730;
}
double f(double x, double y, double z) {
double r573731 = y;
double r573732 = -5.71438945780871e-05;
bool r573733 = r573731 <= r573732;
double r573734 = 0.5;
double r573735 = -1.0;
double r573736 = x;
double r573737 = r573735 * r573736;
double r573738 = exp(r573737);
double r573739 = exp(r573736);
double r573740 = r573738 + r573739;
double r573741 = r573734 * r573740;
double r573742 = z;
double r573743 = r573741 / r573742;
double r573744 = r573743 / r573736;
double r573745 = r573744 * r573731;
double r573746 = 2.3191721167167056e-29;
bool r573747 = r573731 <= r573746;
double r573748 = cosh(r573736);
double r573749 = r573731 / r573736;
double r573750 = r573748 * r573749;
double r573751 = 1.0;
double r573752 = r573751 / r573742;
double r573753 = r573750 * r573752;
double r573754 = r573748 / r573736;
double r573755 = r573731 / r573742;
double r573756 = r573754 * r573755;
double r573757 = r573747 ? r573753 : r573756;
double r573758 = r573733 ? r573745 : r573757;
return r573758;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.8 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
if y < -5.71438945780871e-05Initial program 21.5
Taylor expanded around inf 0.4
Simplified0.4
rmApplied associate-/r/0.4
rmApplied associate-/r*0.4
if -5.71438945780871e-05 < y < 2.3191721167167056e-29Initial program 0.2
rmApplied div-inv0.3
if 2.3191721167167056e-29 < y Initial program 18.6
rmApplied *-un-lft-identity18.6
Applied times-frac18.6
Simplified18.6
Simplified0.4
rmApplied *-un-lft-identity0.4
Applied times-frac0.6
Applied associate-*r*0.6
Simplified0.6
Final simplification0.4
herbie shell --seed 2020021
(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))